AscendDeviceInfo

View Source On Gitee

import com.mindspore.config.AscendDeviceInfo;

The AscendDeviceInfo class is used to configure MindSpore Lite Ascend device options.

Public Member Functions

function

Supported At Cloud-side Inference

Supported At Device-side Inference

int getDeviceID)

int getDeviceType

String getProvider

void setProvider(String provider)

void setDeviceID(int deviceId)

int getRankID()

void setRankID(int rankId)

String getInsertOpConfigPath()

void setInsertOpConfigPath(String insertOpConfigPath)

String getInputFormat()

void setInputFormat(String inputFormat)

String getInputShape()

void setInputShape(String inputShape)

HashMap<Integer, ArrayList> getInputShapeMap()

void setInputShapeMap(HashMap<Integer, ArrayList> inputShapeMap)

ArrayList getDynamicBatchSize()

void setDynamicBatchSize(ArrayList dynamicBatchSize)

String getDynamicImageSize()

void setDynamicImageSize(String dynamicImageSize)

int getOutputType()

void setOutputType(int outputType)

String getPrecisionMode()

void setPrecisionMode(String precisionMode)

String getOpSelectImplMode()

void setOpSelectImplMode(String opSelectImplMode)

String getFusionSwitchConfigPath()

void setFusionSwitchConfigPath(String fusionSwitchConfigPath)

String getBufferOptimizeMode()

void setBufferOptimizeMode(String bufferOptimizeMode)

getDeviceID

public int getDeviceID()

Get the Ascend device ID.

  • Returns

    the deviceId.

getDeviceType

public int getDeviceType()

Get the device type.

  • Returns

    the deviceType.

getProvider

public String getProvider()

Get Ascend device provider.

  • Returns

    the provider.

setProvider

public void setProvider(String provider)

Set Ascend device provider.

  • Parameters

  • provider: provider the provider to set.

setDeviceID

public void setDeviceID(int deviceId)

Set the Ascend device ID.

  • Parameters

  • deviceId: deviceId the deviceId to set.

getRankID

public int getRankID()

Get the logical ID of a distributed model in the cluster.

  • Returns

    the rankId.

setRankID

public void setRankID(int rankId)

Set the logical ID of a distributed model in the cluster.

  • Parameters

  • rankId: rankId the rankId to set.

getInsertOpConfigPath

public String getInsertOpConfigPath()

Get the AIPP configuration file path.

  • Returns

    the insertOpConfigPath.

setInsertOpConfigPath

public void setInsertOpConfigPath(String insertOpConfigPath)

Set the AIPP configuration file path.

  • Parameters

    • insertOpConfigPath: insertOpConfigPath AIPP configuration file path.

getInputFormat

public String getInputFormat()

Get the input format of the model.

  • Returns

    the inputFormat.

setInputFormat

public void setInputFormat(String inputFormat)

Set the input format of the model.Optional "NCHW", "NHWC", and "ND"

  • Parameters

  • inputFormat: inputFormat .

getInputShape

public String getInputShape()

Get the input shape of the model.

  • Returns

    the inputShape.

setInputShape

public void setInputShape(String inputShape)

Set the input shape of the model. e.g. "input_op_name1:1,2,3,4;input_op_name2:4,3,2,1;".

  • Parameters

  • inputShape: inputShape Model input shape.

getInputShapeMap

public HashMap<Integer, ArrayList<Integer>> getInputShapeMap()

Get the input shape mapping of the model.

  • Returns

    the inputShapeMap.

setInputShapeMap

public void setInputShapeMap(HashMap<Integer, ArrayList<Integer>> inputShapeMap)

Model input shape. e.g. {{0, {1,2,3,4}}, {1, {4,3,2,1}}}。

  • Parameters

  • inputShapeMap: inputShapeMap the inputShapeMap to set.

getDynamicBatchSize

public ArrayList<Integer> getDynamicBatchSize()

Get the dynamic batch sizes of the model.

  • Returns

    the dynamicBatchSize.

setDynamicBatchSize

public void setDynamicBatchSize(ArrayList<Integer> dynamicBatchSize)

Dynamic batch sizes of model inputs. Ranges from 2 to 100. e.g. {1, 2} means batch size 1 and 2 are configured.

  • Parameters

  • dynamicBatchSize: dynamicBatchSize the dynamicBatchSize to set.

getDynamicImageSize

public String getDynamicImageSize()

Get the dynamic image sizes of the model.

  • Returns

    the dynamicImageSize.

setDynamicImageSize

public void setDynamicImageSize(String dynamicImageSize)

Set the dynamic image sizes of the model.

  • Parameters

  • dynamicImageSize: dynamicImageSize the dynamicImageSize to set.

getOutputType

public int getOutputType()

Get the output type of the model.

  • Returns

    the outputType.

setOutputType

public void setOutputType(int outputType)

Set the type of model outputs. can be DataType.kNumberTypeFloat32, DataType.kNumberTypeUInt8, or DataType.kNumberTypeFloat16.

  • Parameters

  • outputType: outputType the outputType to set.

getPrecisionMode

public String getPrecisionMode()

Get the precision mode of the model.

  • Returns

    the precisionMode.

setPrecisionMode

public void setPrecisionMode(String precisionMode)

Set the precision mode. Optional "enforce_fp16", "preferred_fp32", "enforce_origin", "enforce_fp32", and "preferred_optimal". "enforce_fp16" is set as default.

  • Parameters

  • precisionMode: precisionMode.

getOpSelectImplMode

public String getOpSelectImplMode()

Get the operator selection implementation mode of the model.

  • Returns

    the opSelectImplMode.

setOpSelectImplMode

public void setOpSelectImplMode(String opSelectImplMode)

Set the operator selection implementation mode of the model. Optional "high_performance" and "high_precision". "high_performace" is set as default.

  • Parameters

  • opSelectImplMode: opSelectImplMode.

getFusionSwitchConfigPath

public String getFusionSwitchConfigPath()

Get fusion switch config file path. It controls which fusion passes to be turned off.

  • Returns

    the fusionSwitchConfigPath.

setFusionSwitchConfigPath

public void setFusionSwitchConfigPath(String fusionSwitchConfigPath)

Set fusion switch config file path.

  • Parameters

  • fusionSwitchConfigPath: fusionSwitchConfigPath the fusionSwitchConfigPath to set.

getBufferOptimizeMode

public String getBufferOptimizeMode()

Set the buffer optimize mode. Optional "l1_optimize", "l2_optimize", or "off_optimize". "l2_optimize" is set as default.

  • Returns

    the bufferOptimizeMode.

setBufferOptimizeMode

public void setBufferOptimizeMode(String bufferOptimizeMode)

Set the buffer optimization mode of the model.

  • Parameters

  • bufferOptimizeMode: bufferOptimizeMode the bufferOptimizeMode to set.