【发布时间】:2018-02-23 22:24:14
【问题描述】:
我已经使用 C# 训练了一个 CNTK 模型,现在我想针对一个包装类运行测试用例,以便我们可以检测到有人用性能不佳的模型替换模型时出现的问题,另外还有重复将神经网络与我们的旧模型进行比较。但是,当我尝试运行测试时,我得到:
Result StackTrace:
at CNTK.CNTKLibPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_CNTKLib(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
at CNTK.CNTKLibPINVOKE.SWIGExceptionHelper..cctor()
--- End of inner exception stack trace ---
...
System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'Cntk.Core.CSBinding-2.3.1.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)
我从独立的控制台应用程序中遇到了同样的错误,并通过确保控制台应用程序和类库都构建为 x64 来修复它。我对测试项目进行了相同的更改,另外将测试架构设置为 x64(测试 > 测试设置 > 默认处理器架构 > x64),但没有骰子。
我正在使用 CNTK (2.3.1) 的 GPU 版本,但对于单元测试上下文,它应该使用 CPU。我已验证 Cntk.Core.CSBinding-2.3.1.dll 存在于 bin 目录中。
有什么想法吗?有人试过吗?
【问题讨论】:
-
在进行涉及需要在 app.config 中输入才能正确初始化的类的单元测试时,我遇到了一个非常相似的错误。我不知道你是否有这个问题,但这个错误几乎总是归结为你的主项目和测试项目之间的一些差异。
标签: c# visual-studio unit-testing cntk