mindspore_lite.AscendDeviceInfo
- class mindspore_lite.AscendDeviceInfo(device_id=0)[源代码]
用于设置Ascend设备信息的Helper类,继承自DeviceInfo基类。
- 参数:
device_id (int,可选) - 设备id。默认值:0。
- 异常:
TypeError - device_id 不是int类型。
ValueError - device_id 小于0。
样例:
>>> 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, .