mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-03 23:49:44 +00:00
removed MklDnn dependency from C# (#455)
This commit is contained in:
parent
e57b5116d6
commit
88949485ff
2 changed files with 4 additions and 5 deletions
|
|
@ -11,7 +11,8 @@
|
|||
<Visible>false</Visible>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\mkldnn.dll"
|
||||
Condition="'$(PlatformTarget)' == 'x64'">
|
||||
Condition="'$(PlatformTarget)' == 'x64' AND
|
||||
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\mkldnn.dll')">
|
||||
<Link>mkldnn.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
public class SessionOptions:IDisposable
|
||||
{
|
||||
public IntPtr _nativePtr;
|
||||
protected static readonly Lazy<SessionOptions> _default = new Lazy<SessionOptions>(MakeSessionOptionWithMklDnnProvider);
|
||||
protected static readonly Lazy<SessionOptions> _default = new Lazy<SessionOptions>(MakeSessionOptionWithCpuProvider);
|
||||
private static string[] cudaDelayLoadedLibs = { "cublas64_100.dll", "cudnn64_7.dll" };
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -46,10 +46,9 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
}
|
||||
}
|
||||
|
||||
private static SessionOptions MakeSessionOptionWithMklDnnProvider()
|
||||
private static SessionOptions MakeSessionOptionWithCpuProvider()
|
||||
{
|
||||
SessionOptions options = new SessionOptions();
|
||||
NativeMethods.OrtSessionOptionsAppendExecutionProvider_Mkldnn(options._nativePtr, 1);
|
||||
NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(options._nativePtr, 1);
|
||||
return options;
|
||||
}
|
||||
|
|
@ -73,7 +72,6 @@ namespace Microsoft.ML.OnnxRuntime
|
|||
CheckCudaExecutionProviderDLLs();
|
||||
SessionOptions options = new SessionOptions();
|
||||
NativeMethods.OrtSessionOptionsAppendExecutionProvider_CUDA(options._nativePtr, deviceId);
|
||||
NativeMethods.OrtSessionOptionsAppendExecutionProvider_Mkldnn(options._nativePtr, 1);
|
||||
NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(options._nativePtr, 1);
|
||||
return options;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue