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.

void SetRankID(uint32_t rank_id)

Set the distribution rank id.

参数

rank_id[in] The rank id.

uint32_t GetRankID() const

Get the distribution rank id.

返回

The rank 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", and "ND".

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. {{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.

返回

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.

参数

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.

返回

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.

参数

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.

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 "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.

返回

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.

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

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

参数

cfg_path[in] fusion switch config file path.

inline std::string GetFusionSwitchConfigPath() const

Get fusion switch config file path.

返回

The fusion switch config file path.

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

Set buffer optimize mode.

参数

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.

返回

The buffer optimize mode.