query_available_dl_devices — 获取支持深度学习的硬件设备列表。
query_available_dl_devices( : : GenParamName, GenParamValue : DLDeviceHandles)
query_available_dl_devices returns a list of handles. Each
handle refers to a deep-learning-capable hardware device
(hereafter referred to as device) that can be
used for inference or training of a deep learning model. For each
returned device, every parameter mentioned in GenParamName
must be equal to at least one of its corresponding values that appear
in GenParamValue. A parameter can have more than one value
by duplicating its name in GenParamName and adding different
corresponding value in GenParamValue。
A deep-learning-capable device is either supported directly through HALCON or through an AI 2-interface.
The devices that are supported directly through HALCON are equivalent
to those that can be set to a deep learning model via
set_dl_model_param using 'runtime' = 'cpu' or
'runtime' = 'gpu'. HALCON provides an internal
implementation for the inference or training of a deep learning model
for those devices. See 深度学习 for more details.
Devices that are supported through the AI
2-interface
can also be set to a deep learning model using set_dl_model_param。In this case the inference is not executed by HALCON but by the device
itself.
query_available_dl_devices returns a handle for each
deep-learning-capable device supported through HALCON and through an
inference engine.
If a device is supported through HALCON and one or several inference
engines, query_available_dl_devices returns a handle for HALCON
and for each inference engine.
GenParamName can be used to filter for the devices.
All GenParamName that are gettable by get_dl_device_param
and that do not return a handle-typed value for GenParamValue
are supported for filtering. See the operator reference of
get_dl_device_param for the list of gettable parameters.
In addition, the following values are supported:
The devices, which are directly supported by HALCON for this device type.
Possible values (standard): 'cpu', 'gpu'.
GenParamName can have multiple entries for the same value.
In this case filter combines the entries with a logical 'or'.
Please see the example code below for some examples how to use the
filter.
此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。
GenParamName (输入控制) attribute.name(-array) → (string)
Name of the generic parameter.
默认值: []
值列表: 'ai_accelerator_interface', 'calibration_precisions', 'cast_precisions', 'conversion_supported', 'id', 'inference_only', 'name', 'optimize_for_inference_params', 'precisions', 'runtime', 'settable_device_params', 'type'
GenParamValue (输入控制) attribute.value(-array) → (string / integer / real)
Value of the generic parameter.
默认值: []
建议值:
DLDeviceHandles (输出控制) dl_device(-array) → (handle)
Tuple of DLDevice handles
* Query all deep-learning-capable hardware devices
query_available_dl_devices ([], [], DLDeviceHandles)
* Query all GPUs with ID 0 or 2
query_available_dl_devices (['type', 'id', 'id'], ['gpu', 0, 2],\
DLDeviceHandles)
* Query the unique GPU with ID 1 supported by HALCON
query_available_dl_devices (['runtime', 'id'], ['gpu', 1], DLDeviceHandles)
如果参数有效,算子
query_available_dl_devices 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
基础