Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 4c11054

Browse files
committed
Support all device types
1 parent b1f15f1 commit 4c11054

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

OnnxStack.Core/Extensions/Extensions.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,17 @@ public static SessionOptions GetSessionOptions(this OnnxModelConfig configuratio
3939
sessionOptions.AppendExecutionProvider_CoreML(CoreMLFlags.COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE);
4040
return sessionOptions;
4141
case ExecutionProvider.OpenVino:
42-
//TODO: DeviceId = "CPU_FP32"|"GPU_FP32"|"GPU_FP16"|"MYRIAD_FP16"|"VAD-M_FP16"|"VAD-F_FP32"
43-
sessionOptions.AppendExecutionProvider_OpenVINO();
42+
var deviceId = configuration.DeviceId switch
43+
{
44+
0 => "CPU_FP32",
45+
1 => "GPU_FP32",
46+
2 => "GPU_FP16",
47+
3 => "MYRIAD_FP16",
48+
4 => "VAD-M_FP16",
49+
5 => "VAD-F_FP32",
50+
_ => string.Empty
51+
};
52+
sessionOptions.AppendExecutionProvider_OpenVINO(deviceId);
4453
return sessionOptions;
4554
}
4655
}

0 commit comments

Comments
 (0)