mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Correct logic for GPU backend detection (#13944)
Currently these checks yield the opposite of the desired logic.
This commit is contained in:
parent
526368f4d8
commit
067d425306
1 changed files with 2 additions and 2 deletions
|
|
@ -74,7 +74,7 @@ def optimize_by_onnxruntime(
|
|||
|
||||
import onnxruntime
|
||||
|
||||
if use_gpu and not set(onnxruntime.get_available_providers()).isdisjoint(
|
||||
if use_gpu and set(onnxruntime.get_available_providers()).isdisjoint(
|
||||
["CUDAExecutionProvider", "ROCMExecutionProvider", "MIGraphXExecutionProvider"]
|
||||
):
|
||||
logger.error("There is no gpu for onnxruntime to do optimization.")
|
||||
|
|
@ -112,7 +112,7 @@ def optimize_by_onnxruntime(
|
|||
gpu_ep.append("ROCMExecutionProvider")
|
||||
|
||||
session = onnxruntime.InferenceSession(onnx_model_path, sess_options, providers=gpu_ep, **kwargs)
|
||||
assert set(onnxruntime.get_available_providers()).isdisjoint(
|
||||
assert not set(onnxruntime.get_available_providers()).isdisjoint(
|
||||
["CUDAExecutionProvider", "ROCMExecutionProvider", "MIGraphXExecutionProvider"]
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue