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

Commit f4fbe5a

Browse files
authored
Merge pull request #71 from saddam213/OpenVino
Add OpenVino EP support
2 parents 98e5264 + 4c11054 commit f4fbe5a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

OnnxStack.Core/Config/ExecutionProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public enum ExecutionProvider
55
DirectML = 0,
66
Cuda = 1,
77
Cpu = 2,
8-
CoreML = 3
8+
CoreML = 3,
9+
OpenVino = 4
910
}
1011
}

OnnxStack.Core/Extensions/Extensions.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@ public static SessionOptions GetSessionOptions(this OnnxModelConfig configuratio
3636
sessionOptions.AppendExecutionProvider_CPU();
3737
return sessionOptions;
3838
case ExecutionProvider.CoreML:
39-
sessionOptions.AppendExecutionProvider_CoreML(
40-
CoreMLFlags.COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE
41-
);
39+
sessionOptions.AppendExecutionProvider_CoreML(CoreMLFlags.COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE);
40+
return sessionOptions;
41+
case ExecutionProvider.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);
4253
return sessionOptions;
4354
}
4455
}

0 commit comments

Comments
 (0)