mindspore_lite.AscendDeviceInfo
- class mindspore_lite.AscendDeviceInfo(device_id=0)[source]
Helper class used to describe Ascend device hardware information, and it inherits
mindspore_lite.DeviceInfo
base class.- Parameters
device_id (int, optional) – The device id. Default: 0.
- Raises
TypeError – device_id is not an int.
ValueError – device_id is less than 0.
Examples
>>> # Use case: inference on Ascend device. >>> # precondiction 1: Building MindSpore Lite Ascend package on Ascend device. >>> # precondiction 2: install wheel package of MindSpore Lite built by precondiction 1. >>> import mindspore_lite as mslite >>> ascend_device_info = mslite.AscendDeviceInfo(device_id=0) >>> print(ascend_device_info) device_type: DeviceType.kAscend, device_id: 0. >>> cpu_device_info = mslite.CPUDeviceInfo(enable_fp16=False) >>> context = mslite.Context() >>> context.append_device_info(ascend_device_info) >>> context.append_device_info(cpu_device_info) >>> print(context) thread_num: 0, inter_op_parallel_num: 0, thread_affinity_mode: 0, thread_affinity_core_list: [], enable_parallel: False, device_list: 3, 0, .