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”, and “ND”.

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. {{0, {1,2,3,4}}, {1, {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.

void SetDynamicBatchSize(const std::vector<size_t> &dynamic_batch_size)

Set dynamic batch sizes of model inputs. Ranges from 2 to 100.

Parameters

dynamic_batch_size[in] e.g. {1, 2} means batch size 1 and 2 are configured.

inline std::string GetDynamicBatchSize() const

Get dynamic batch sizes of model inputs.

Returns

The dynamic batch sizes of model inputs in string format.

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.

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 “enforce_fp16”, “preferred_fp32”, “enforce_origin”, “enforce_fp32” and “preferred_optimal”, “enforce_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.

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

Set fusion switch config file path. Controls which fusion passes to be turned off.

Parameters

cfg_path[in] fusion switch config file path.

inline std::string GetFusionSwitchConfigPath() const

Get fusion switch config file path.

Returns

The fusion switch config file path.

inline void SetBufferOptimizeMode(const std::string &buffer_optimize_mode)

Set buffer optimize mode.

Parameters

buffer_optimize_mode[in] Optional “l1_optimize”, “l2_optimize”, “off_optimize” or “l1_and_l2_optimize”, default as “l2_optimize”.

inline std::string GetBufferOptimizeMode() const

Get buffer optimize mode.

Returns

The buffer optimize mode.