removed MklDnn dependency from C# (#455)

This commit is contained in:
shahasad 2019-02-11 14:23:09 -08:00 committed by GitHub
parent e57b5116d6
commit 88949485ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -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>

View file

@ -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;
}