Class Serialization

Class Documentation

class Serialization

The Serialization class is used to summarize methods for reading and writing model files.

Public Static Functions

static inline Status Load(const void *model_data, size_t data_size, ModelType model_type, Graph *graph, const Key &dec_key = {}, const std::string &dec_mode = kDecModeAesGcm)

Loads a model file from memory buffer.

Parameters
  • model_data[in] A buffer filled by model file.

  • data_size[in] The size of the buffer.

  • model_type[in] The Type of model file, options are ModelType::kMindIR, ModelType::kOM.

  • graph[out] The output parameter, an object saves graph data.

  • dec_key[in] The decryption key, key length is 16, 24, or 32.

  • dec_mode[in] The decryption mode, optional options are AES-GCM, AES-CBC.

Returns

Status.

static inline Status Load(const std::string &file, ModelType model_type, Graph *graph, const Key &dec_key = {}, const std::string &dec_mode = kDecModeAesGcm)

Loads a model file from path, is not supported on MindSpore Lite.

Parameters
  • file[in] The path of model file.

  • model_type[in] The Type of model file, options are ModelType::kMindIR, ModelType::kOM.

  • graph[out] The output parameter, an object saves graph data.

  • dec_key[in] The decryption key, key length is 16, 24, or 32.

  • dec_mode[in] The decryption mode, optional options are AES-GCM, AES-CBC.

Returns

Status.

static inline Status Load(const std::vector<std::string> &files, ModelType model_type, std::vector<Graph> *graphs, const Key &dec_key = {}, const std::string &dec_mode = kDecModeAesGcm)

Load multiple models from multiple files, MindSpore Lite does not provide this feature.

Parameters
  • files[in] The path of model files.

  • model_type[in] The Type of model file, options are ModelType::kMindIR, ModelType::kOM.

  • graph[out] The output parameter, an object saves graph data.

  • dec_key[in] The decryption key, key length is 16, 24, or 32.

  • dec_mode[in] The decryption mode, optional options are AES-GCM, AES-CBC.

Returns

Status.