Program Listing for File converter_context.h
↰ Return to documentation for file (include/converter/include/registry/converter_context.h
)
#ifndef MINDSPORE_LITE_INCLUDE_REGISTRY_CONVERTER_CONTEXT_H_
#define MINDSPORE_LITE_INCLUDE_REGISTRY_CONVERTER_CONTEXT_H_
#include <map>
#include <string>
#include <vector>
#include "include/api/types.h"
#include "include/api/dual_abi_helper.h"
namespace mindspore {
namespace converter {
constexpr auto KConverterParam = "converter_parameters";
constexpr auto KCommonQuantParam = "common_quant_param";
constexpr auto KFullQuantParam = "full_quant_param";
constexpr auto KDataPreProcess = "data_preprocess_param";
constexpr auto KMixBitWeightQuantParam = "mixed_bit_weight_quant_param";
enum class MS_API FmkType : int {
kFmkTypeTf = 0,
kFmkTypeCaffe = 1,
kFmkTypeOnnx = 2,
kFmkTypeMs = 3,
kFmkTypeTflite = 4,
kFmkTypePytorch = 5,
kFmkTypeMsLite = 6,
};
struct MS_API ConverterParameters {
FmkType fmk;
ModelType save_type = kMindIR_Lite;
std::string model_file;
std::string weight_file;
std::map<std::string, std::string> attrs;
};
class MS_API ConverterContext {
public:
ConverterContext() = default;
~ConverterContext() = default;
static void SetGraphOutputTensorNames(const std::vector<std::string> &output_names) {
SetGraphOutputTensorNames(VectorStringToChar(output_names));
}
static std::vector<std::string> GetGraphOutputTensorNames() {
return VectorCharToString(GetGraphOutputTensorNamesInChar());
}
static std::map<std::string, std::string> GetConfigInfo(const std::string §ion) {
return MapVectorCharToString(GetConfigInfo(StringToChar(section)));
}
private:
static void SetGraphOutputTensorNames(const std::vector<std::vector<char>> &&output_names);
static std::vector<std::vector<char>> GetGraphOutputTensorNamesInChar();
static std::map<std::vector<char>, std::vector<char>> GetConfigInfo(const std::vector<char> &§ion);
};
} // namespace converter
} // namespace mindspore
#endif // MINDSPORE_LITE_INCLUDE_REGISTRY_CONVERTER_CONTEXT_H_