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.

Returns

Type of this DeviceInfoContext.

void SetDeviceID(uint32_t device_id)

Set device id.

Parameters

device_id[in] The device id.

uint32_t GetDeviceID() const

Get the device id.

Returns

The device id.

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

Set AIPP configuration file path.

Parameters

cfg_path[in] AIPP configuration file path.

inline std::string GetInsertOpConfigPath() const

Get AIPP configuration file path.

Returns

AIPP configuration file path.

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

Set format of model inputs.

Parameters

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

inline std::string GetInputFormat() const

Get format of model inputs.

Returns

The format of model inputs.

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

Set shape of model inputs.

Parameters

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.

Returns

The shape of model inputs.

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

Set shape of model inputs.

Parameters

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.

Returns

The shape of model inputs.

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

Set the dynamic image size of model inputs.

Parameters

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.

Returns

The image size of model inputs.

void SetOutputType(enum DataType output_type)

Set type of model outputs.

Parameters

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

enum DataType GetOutputType() const

Get type of model outputs.

Returns

The set type of model outputs.

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

Set precision mode of model.

Parameters

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.

Returns

The set type of model outputs

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

Set op select implementation mode.

Parameters

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.

Returns

The set op select implementation mode.