Hello everyone.
I faced something weird today. the release build works just fine, but whenever I switch to the debug build, the deserialization fails with the following error :
Unhandled exception at 0x00007FFF7DE1A308 in Test.exe: Microsoft C++ exception: c10::Error at memory location 0x000000CDEE5BD950. occurred
The exception is raised in this function :
torch::Tensor deserialize_tensor(std::string input)
{
torch::Tensor tensor;
std::stringstream stream(input);
torch::load(tensor, stream);
return tensor;
}
and ultimately it fails inside the torch::load()
inside tensor.h
:
#pragma once
#include <torch/serialize/archive.h>
#include <torch/types.h>
namespace torch {
inline serialize::OutputArchive& operator<<(
serialize::OutputArchive& archive,
const Tensor& tensor) {
archive.write("0", tensor);
return archive;
}
inline serialize::InputArchive& operator>>(
serialize::InputArchive& archive,
Tensor& tensor) {
archive.read("0", tensor); // it crashes here!
return archive;
}
} // namespace torch
here is the snapshot showing where exactly it failed :
Whats wrong here?
Any help is greatly apprecaited.
Thanks a lot in advance