CSEvalClient project "Debug Assertion Fialed" error!
Hi all:
I run project CSEvalClient into method " EvaluateNetworkSingleLayer", program occur an error
private static void EvaluateNetworkSingleLayer()
{
try
{
// The examples assume the executable is running from the data folder
// We switch the current directory to the data folder (assuming the executable is in the <CNTK>/x64/Debug|Release folder
string workingDirectory = Path.Combine(initialDirectory, @"..\..\Examples\Other\Simple2d\Config");
Environment.CurrentDirectory = initialDirectory;
List<float> outputs;
using (var model = new IEvaluateModelManagedF())
{
// Initialize model evaluator
model.Init("deviceId=-1");
// Create the network
string networkDescription = GetFileContents(Path.Combine(workingDirectory, @"AddOperatorConstant.cntk"));
model.CreateNetwork(networkDescription);
// Generate random input values in the appropriate structure and size
var inputs = new Dictionary<string, List<float>>() { { "features", new List<float>() { { 1.0f } } } };
// We can call the evaluate method and get back the results (single layer)...
outputs = model.Evaluate(inputs, "ol", 1); //<<<---this place
}
OutputResults("ol", outputs);
}
catch (CNTKException ex)
{
Console.WriteLine("Error: {0}\nNative CallStack: {1}\n Inner Exception: {2}", ex.Message, ex.NativeCallStack, ex.InnerException != null ? ex.InnerException.Message : "No Inner Exception");
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}\nCallStack: {1}\n Inner Exception: {2}", ex.Message, ex.StackTrace, ex.InnerException != null ? ex.InnerException.Message : "No Inner Exception");
}
}
----------------error window content ---------
Debug Assertion Failed!
Program: C:\WIndows\System32\MSVCP120D.dll File:C:\Program files(x86)\Microsoft Visual Studio 12.0\VC\include\vector Line:1185
Expression: vector subscript out of range
For information on how your program can cause an assertion failure,see the Visual C++ documentation on asserts.
(Press Retry to debug the application) --------------------end-------------------------------------
i have no idea and this cost my one all day! anybody can help me?please!
thx!
two days ..... no anybody knew what happen? i feel a little sad..
Do you have it in the debugger? Could you share a call stack? We'd need a native call stack, i.e. not only from C#. You may need to enable mixed-mode debugging.
Error coming from EvalWrapper.cpp line 218
m_eval->Evaluate(stdInputs, stdOutputs); 000005ce mov rdx,qword ptr [rbp+18h] 000005d2 mov rdx,qword ptr [rdx+8] 000005d6 mov qword ptr [rbp+000001A8h],rdx 000005dd mov rdx,qword ptr [rbp+18h] 000005e1 mov rdx,qword ptr [rdx+8] 000005e5 mov rdx,qword ptr [rdx] 000005e8 mov r8d,30h 000005ee movsxd r8,r8d 000005f1 mov rdx,qword ptr [rdx+r8] 000005f5 mov qword ptr [rbp+000001B0h],rdx 000005fc lea rdx,[rbp+00000278h] 00000603 lea r8,[rbp+00000290h] 0000060a mov r10,qword ptr [rbp+000001B0h] 00000611 mov rcx,qword ptr [rbp+000001A8h] 00000618 mov r11d,1B125588h 0000061e call 000000005F671AC0
Dropping out at call
Call Stack:
EvalWrapper.dll!Microsoft::MSR::CNTK::Extensibility::Managed::IEvaluateModelManaged
::Evaluate(System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List ^>^ inputs = 0x00000000028a3b28, System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List ^>^ outputs = 0x00000000028a3cc8) Line 218 + 0x50 bytes C++ EvalWrapper.dll!Microsoft::MSR::CNTK::Extensibility::Managed::IEvaluateModelManaged ::Evaluate(System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List ^>^ inputs = 0x00000000028a3b28, System::String^ outputKey = "ol", int outputSize = 1) Line 266 C++ CSEvalClient.exe!Microsoft.MSR.CNTK.Extensibility.Managed.CSEvalClient.Program.EvaluateNetworkSingleLayer() Line 171 + 0x24 bytes C# CSEvalClient.exe!Microsoft.MSR.CNTK.Extensibility.Managed.CSEvalClient.Program.Main(string[] args = {string[0]}) Line 50 + 0x5 bytes C# [Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x7f bytes
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x35 bytes
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x160 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x17 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x52 bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x52 bytes
[Native to Managed Transition]
This only shows the call stack of the C# wrapper. But the error happens inside an STL object, which is native C++ code.
Can you confirm this is the latest version?
when error coming,I can't get native c++ code debugger information,because my call stack window is nothing. you said enable mixed-mode debugging , I don't kown how to enable it, i can't find it option,where is this option? but I think HthSolid is right.I step into from c#code to EvalWrapper.cpp line 218,I can't continue debugging, only a "Debug Assertion Failed!" dialog shown,and call stack window all information is disappeared.
yes, my confirm is the latest version!
I Press Ctrl+F5 run,when error occur, start a vs2013 instance to debug,get this infomation.It is useful?
EvalDll.dll! std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase,std::allocator<std::shared_pt rMicrosoft::MSR::CNTK::ComputationNodeBase > >::operator[](unsigned __int64 _Pos) Line 1193 C++
EvalDll.dll!Microsoft::MSR::CNTK::CNTKEval<float>::GetNodeDimensions
(std::mapstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> >,unsigned __int64,std::lessstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> >
,std::allocatorstd::pair<std::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_ t> > const ,unsigned __int64> > > & dimensions, Microsoft::MSR::CNTK::NodeGroup nodeGroup) Line 103 C++
EvalDll.dll!Microsoft::MSR::CNTK::CNTKEval<float>::Evaluate
(std::mapstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t>
,std::vector<float,std::allocator
> *,std::lessstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > ,std::allocatorstd::pair<std::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_ t> > const ,std::vector<float,std::allocator > *> > > & inputs, std::mapstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> ,std::vector<float,std::allocator > *,std::lessstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > ,std::allocatorstd::pair<std::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_ t> > const ,std::vector<float,std::allocator > *> > > & outputs) Line 162 C++
It is the option "Enable native code debugging", under "Enable Debuggers." If you check that box, you should get a full native call stack.

thx! I get this call stack! @frankseide
msvcp120d.dll!000007fef32865d6()
[Frames below may be incorrect and/or missing, no symbols loaded for msvcp120d.dll]
EvalDll.dll!std::vectorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase,std::allocatorstd::shared_ptr<Microsoft::MSR::CNTK::ComputationNodeBase > >::operator[](unsigned __int64 _Pos) Line 1186 C++ EvalDll.dll!Microsoft::MSR::CNTK::CNTKEval
::GetNodeDimensions(std::mapstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> >,unsigned __int64,std::lessstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > >,std::allocatorstd::pair<std::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > const ,unsigned __int64> > > & dimensions, Microsoft::MSR::CNTK::NodeGroup nodeGroup) Line 103 + 0xc bytes C++ EvalDll.dll!Microsoft::MSR::CNTK::CNTKEval ::Evaluate(std::mapstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> >,std::vector<float,std::allocator > *,std::lessstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > >,std::allocatorstd::pair<std::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > const ,std::vector<float,std::allocator > *> > > & inputs, std::mapstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> >,std::vector<float,std::allocator > *,std::lessstd::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > >,std::allocatorstd::pair<std::basic_string<wchar_t,std::char_traits<wchar_t,std::allocator<wchar_t> > const ,std::vector<float,std::allocator > *> > > & outputs) Line 162 C++ [External Code] EvalWrapper.dll!Microsoft::MSR::CNTK::Extensibility::Managed::IEvaluateModelManaged ::Evaluate(System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List ^>^ inputs, System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List ^>^ outputs) Line 219 C++ EvalWrapper.dll!Microsoft::MSR::CNTK::Extensibility::Managed::IEvaluateModelManaged ::Evaluate(System::Collections::Generic::Dictionary<System::String^, System::Collections::Generic::List ^>^ inputs, System::String^ outputKey, int outputSize) Line 266 C++ CSEvalClient.exe!Microsoft.MSR.CNTK.Extensibility.Managed.CSEvalClient.Program.EvaluateNetworkSingleLayer() Line 171 + 0x30 bytes C# CSEvalClient.exe!Microsoft.MSR.CNTK.Extensibility.Managed.CSEvalClient.Program.Main(string[] args) Line 50 + 0x5 bytes C# mscoreei.dll!000007fef4a377ad()
mscoree.dll!000007fef7bc5b21()
kernel32.dll!0000000076c259bd()
ntdll.dll!0000000076e5a2e1()
I follow the code manually by F10\F11 as follows: _DEBUG_ERROR("vector subscript out of range"); vector line 1185
auto& nodes = m_net->InputNodes(outputNodes[0]); CNTKEval.cpp line 110
m_reader->SetData(&inputs, &m_dimensions);CNTKEval.cpp line 162 } EvalWrapper.cpp line 219 return outputMap[outputKey]; EvalWrapper.cpp line 266 outputs = model.Evaluate(inputs, "ol", 1); program.cs line 171 EvaluateNetworkSingleLayer(); program.cs line 50
this screenshot can useful?


Thanks so much! So we can circle the problem quite a bit. The first screenshot shows that the outputNodes array has 0 elements. So the system does not know which node to evaluate. (And it is our bug that it does not catch this to produce a proper error message.)
You pass node name ol. Could you check the log output to see whether it has a node called ol, and whether that node is marked either with tag='output' or listed in something like OutputNodes=...?
If you are using SimpleNetworkBuilder, then please look at the validation output, there we can at least see whether the node exists.
I think I get a little you mean,this are ConfigFile(AddOperatorConstant.cntk is get from github and I change nothing) and Console Out Content,can useful? @frankseide thk!
Maybe sth here you are looking for?

outputs

inputs

Other 2 Entries value and key, same in outputs and inputs

outputNodes is empty

m_net

In CTNKEval.cpp:
auto& nodes = m_net->InputNodes(outputNodes[0]);
It is the direct reference to element [0] in outputNodes that causes our problem, a pointer that doesn't exist in an empty object. try catch this error? but shouldnt happen in first case with this example...
To summarize: The CSEvalClient has several examples of how to evaluate a network. One of the examples uses a simple network containing a Plus operator fed by a Constant (value of 1) and the Input. The Plus operator is named "ol" and is marked as the OutputNode. Somehow (tbd) the NDLNetworkBuilder is not creating or recognizing the "ol" node as the output layer. So when the client attempts to read that layer, it is not found, throwing the exception. What I have identified so far is that during the call to GetModelFromConfig inside the NetworkFactory, the network is built properly (with the outputNodes array containing an entry for the "ol" node NetworkFactory.cpp[159]). However, right after the call to PatchOutputNodes, the network no longer reports any output nodes. I am looking into how the patching of the output nodes works and why it removes "ol" as an output.
Inside the AddOperatorConstant.cntk and AddOperatorConstantNoInput.cntk files (located in
<cntk>/Examples/Other/SImple2d/Config
please replace:
outputNodeNames = AddResult
with:
outputNodeNames = "ol"
You can also just remove that line, the eval wrapper will assume the OutputNode to be the output.
This seems to correct the issue. I will begin the code/review integration process shortly Best regards.
can confirm
it works !thk!
Hi, I have the same error with you. So I would like to ask you how do you solve the problem? Please send email to [email protected].