OrtGetInitializerLocationFunc typedef

\brief Function called by ORT to allow user to specify how an initializer should be saved, that is, either written to an external file or stored within the model. ORT calls this function for every initializer when generating a model.

If the function implementation sets the new_external_info output parameter to NULL, ORT stores the initializer data within the generated model.

Otherwise, if the function implementation sets new_external_info to a valid OrtExternalInitializerInfo instance, ORT assumes that this function stores the initializer data in a file. In this case, ORT configures the model's initializer to point to the location specified by the new_external_info output parameter.

\paramin state Opaque pointer holding the user's state. \paramin initializer_name The initializer's name as a null-terminated string. \paramin initializer_value OrtValue containing the initializer's data, type, and shape. \paramin external_info If the initializer is originally stored in an external file, external_info contains the file path, file offset, and the data's byte size within the file. Otherwise, external_info is NULL if the initializer is not originally stored in a file. \paramout new_external_info Output parameter set to a new OrtExternalInitializerInfo instance indicating the location where the function implementation stored the initializer data. The function implementation must use OrtApi::CreateExternalInitializerInfo() to create the instance. If the function implementation sets new_external_info to NULL, ORT stores the initializers within the model.

\note ORT takes ownership of the new_external_info output parameter.

\return OrtStatus* Write status. Return nullptr on success. Use CreateStatus to provide error info. Use ORT_FAIL as the error code. ORT will release the OrtStatus* if not null.

Implementation

typedef OrtGetInitializerLocationFunc =
    ffi.Pointer<ffi.NativeFunction<OrtGetInitializerLocationFuncFunction>>;