Program Listing for File converter.h

Return to documentation for file (include/converter/include/converter.h)

#ifndef MINDSPORE_LITE_INCLUDE_CONVERTER_H_
#define MINDSPORE_LITE_INCLUDE_CONVERTER_H_

#include <map>
#include <string>
#include <vector>
#include <memory>
#include "include/api/format.h"
#include "include/api/status.h"
#include "include/registry/converter_context.h"

namespace mindspore {
struct ConverterPara;
class MS_API Converter {
 public:
  Converter(converter::FmkType fmk_type, const std::string &model_file, const std::string &output_file = "",
            const std::string &weight_file = "");
  ~Converter() = default;

  void SetConfigFile(const std::string &config_file);
  std::string GetConfigFile() const;

  void SetConfigInfo(const std::string &section, const std::map<std::string, std::string> &config);
  std::map<std::string, std::map<std::string, std::string>> GetConfigInfo() const;

  void SetWeightFp16(bool weight_fp16);
  bool GetWeightFp16() const;

  void SetInputShape(const std::map<std::string, std::vector<int64_t>> &input_shape);
  std::map<std::string, std::vector<int64_t>> GetInputShape() const;

  void SetInputFormat(Format format);
  Format GetInputFormat() const;

  void SetInputDataType(DataType data_type);
  DataType GetInputDataType();

  void SetOutputDataType(DataType data_type);
  DataType GetOutputDataType();

  void SetExportMindIR(ModelType export_mindir);
  ModelType GetExportMindIR() const;

  void SetDecryptKey(const std::string &key);
  std::string GetDecryptKey() const;

  void SetDecryptMode(const std::string &mode);
  std::string GetDecryptMode() const;

  void SetEnableEncryption(bool encryption);
  bool GetEnableEncryption() const;

  void SetEncryptKey(const std::string &key);
  std::string GetEncryptKey() const;

  void SetInfer(bool infer);
  bool GetInfer() const;

  void SetTrainModel(bool train_model);
  bool GetTrainModel() const;

  void SetNoFusion(bool no_fusion);
  bool GetNoFusion();

  void SetDevice(const std::string &device);
  std::string GetDevice();

  Status Convert();
  void *Convert(size_t *data_size);

 private:
  std::shared_ptr<ConverterPara> data_;
};
}  // namespace mindspore
#endif  // MINDSPORE_LITE_INCLUDE_CONVERTER_H_