mindspore_lite.CPUDeviceInfo

class mindspore_lite.CPUDeviceInfo(enable_fp16=False)[源代码]

用于设置CPU设备信息的Helper类,继承自DeviceInfo基类。

参数:
  • enable_fp16 (bool,可选) - 启用以执行float16推理。默认值:False。

异常:
  • TypeError - enable_fp16 不是bool类型。

样例:

>>> import mindspore_lite as mslite
>>> cpu_device_info = mslite.CPUDeviceInfo(enable_fp16=True)
>>> print(cpu_device_info)
device_type: DeviceType.kCPU,
enable_fp16: True.
>>> context = mslite.Context()
>>> 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: 0, .