Overview

Description

Returns a global singleton configuration object for initializing an NPU device. By modifying the options of the global singleton object, you can control the initialization options of the NPU device. This API must be called before the npu.open API call.

This section describes the global singleton configuration provided by the NPU.

Prototype

npu.global_options()

Example

Set the global configuration options before initializing the NPU. For example, to change the precision mode from the allow_fp32_to_fp16 to allow_mix_precision, make the following calls.

1
2
3
import npu_device as npu
npu.global_options().precision_mode = 'allow_mix_precision'
npu.open().as_default()