Hi!
The following program works fine using Debug build. But on Release build it gives the runtime error:
Unhandled exception thrown: read access violation:
_Right was 0x10.
I tried to compile the program with different compiler options (using Microsoft Visual C++ compiler). It works with /MDd option (debug run-time library), and fails with /MD option (release run-time library)
What can be the reason for that?
Here is full program code:
#include <torch/torch.h>
int main() {
torch::nn::Sequential(torch::nn::Linear(1, 1));
}
Stacktrace:
> MyChessCpp.exe!std::operator==<char,std::char_traits<char>,std::allocator<char>>(const std::string & _Left, const std::string & _Right)Line 4378 C++
[Embedded frame] MyChessCpp.exe!std::equal_to<std::string>::operator()(const std::string &)Line 91 C++
[Embedded frame] MyChessCpp.exe!std::_Uhash_compare<std::string,std::hash<std::string>,std::equal_to<std::string>>::operator()(const std::string &)Line 164 C++
[Embedded frame] MyChessCpp.exe!std::_Hash<std::_Umap_traits<std::string,unsigned __int64,std::_Uhash_compare<std::string,std::hash<std::string>,std::equal_to<std::string>>,std::allocator<std::pair<std::string const ,unsigned __int64>>,0>>::_Find_last(const std::string &)Line 1677 C++
MyChessCpp.exe!std::_Hash<std::_Umap_traits<std::string,unsigned __int64,std::_Uhash_compare<std::string,std::hash<std::string>,std::equal_to<std::string>>,std::allocator<std::pair<std::string const ,unsigned __int64>>,0>>::count<void>(const std::string & _Keyval)Line 1360 C++
MyChessCpp.exe!torch::OrderedDict<std::string,std::shared_ptr<torch::nn::Module>>::insert<std::string,std::shared_ptr<torch::nn::Module>>(std::string && key, std::shared_ptr<torch::nn::Module> && value)Line 363 C++
MyChessCpp.exe!torch::OrderedDict<std::string,std::shared_ptr<torch::nn::Module>>::insert(std::string key, std::shared_ptr<torch::nn::Module> && value)Line 373 C++
MyChessCpp.exe!torch::nn::Module::register_module<torch::nn::Module>(std::string name, std::shared_ptr<torch::nn::Module> module)Line 649 C++
MyChessCpp.exe!torch::nn::SequentialImpl::push_back(std::string name, torch::nn::AnyModule any_module)Line 255 C++
[Embedded frame] MyChessCpp.exe!torch::nn::SequentialImpl::push_back(std::string)Line 203 C++
MyChessCpp.exe!torch::nn::SequentialImpl::push_back<torch::nn::ReLUImpl>(std::string name, const torch::nn::ModuleHolder<torch::nn::ReLUImpl> & module_holder)Line 236 C++
[Embedded frame] MyChessCpp.exe!torch::nn::SequentialImpl::push_back(const torch::nn::ModuleHolder<torch::nn::ReLUImpl> &)Line 229 C++
[Embedded frame] MyChessCpp.exe!torch::nn::SequentialImpl::{ctor}(torch::nn::ReLU &&)Line 103 C++
[Embedded frame] MyChessCpp.exe!torch::nn::ModuleHolder<torch::nn::SequentialImpl>::{ctor}(torch::nn::ReLU &&)Line 64 C++
MyChessCpp.exe!torch::nn::Sequential::Sequential<torch::nn::ReLU,void>(torch::nn::ReLU && __param0)Line 20 C++
MyChessCpp.exe!main()Line 4 C++
[External code]