Class AscendDeviceInfo

Inheritance Relationships

Base Type

Class Documentation

class AscendDeviceInfo : public mindspore::DeviceInfoContext

Derived from DeviceInfoContext, The configuration of the model running on the Ascend. This option is invalid for MindSpore Lite.

Public Functions

inline virtual enum DeviceType GetDeviceType() const override

Get the type of this DeviceInfoContext.

返回

Type of this DeviceInfoContext.

void SetDeviceID(uint32_t device_id)

Set device id.

参数

device_id[in] The device id.

uint32_t GetDeviceID() const

Get the device id.

返回

The device id.

inline void SetInsertOpConfigPath(const std::string &cfg_path)

Set AIPP configuration file path.

参数

cfg_path[in] AIPP configuration file path.

inline std::string GetInsertOpConfigPath() const

Get AIPP configuration file path.

返回

AIPP configuration file path.

inline void SetInputFormat(const std::string &format)

Set format of model inputs.

参数

format[in] Optional “NCHW”, “NHWC”, etc.

inline std::string GetInputFormat() const

Get format of model inputs.

返回

The format of model inputs.

inline void SetInputShape(const std::string &shape)

Set shape of model inputs.

参数

shape[in] e.g. “input_op_name1: 1,2,3,4;input_op_name2: 4,3,2,1”.

inline std::string GetInputShape() const

Get shape of model inputs.

返回

The shape of model inputs.

void SetInputShapeMap(const std::map<int, std::vector<int>> &shape)

Set shape of model inputs.

参数

shape[in] e.g. {{1, {1,2,3,4}}, {2, {4,3,2,1}}} means the first input shape 1,2,3,4 and the second input shape 4,3,2,1.

std::map<int, std::vector<int>> GetInputShapeMap() const

Get shape of model inputs.

返回

The shape of model inputs.

inline void SetDynamicImageSize(const std::string &dynamic_image_size)

Set the dynamic image size of model inputs.

参数

dynamic_image_size[in] size hw e.g. “66,88;32,64” means h1:66,w1:88; h2:32,w2:64.

inline std::string GetDynamicImageSize() const

Get dynamic image size of model inputs.

返回

The image size of model inputs.

void SetOutputType(enum DataType output_type)

Set type of model outputs.

参数

output_type[in] FP32, UINT8 or FP16, default as FP32.

enum DataType GetOutputType() const

Get type of model outputs.

返回

The set type of model outputs.

inline void SetPrecisionMode(const std::string &precision_mode)

Set precision mode of model.

参数

precision_mode[in] Optional “force_fp16”, “allow_fp32_to_fp16”, “must_keep_origin_dtype” and “allow_mix_precision”, “force_fp16” is set as default

inline std::string GetPrecisionMode() const

Get precision mode of model.

返回

The set type of model outputs

inline void SetOpSelectImplMode(const std::string &op_select_impl_mode)

Set op select implementation mode.

参数

op_select_impl_mode[in] Optional “high_performance” and “high_precision”, “high_performance” is set as default.

inline std::string GetOpSelectImplMode() const

Get op select implementation mode.

返回

The set op select implementation mode.