I tried to save a tensor in LibTorch and load it from PyTorch but it failed. My LibTorch and PyTorch version are both 1.5.1. Does anyone have any clues or workaround? Thanks!
In C++, I used the following code to save an image tensor.
auto filename = “sample.img”;
torch::save(
fake_img,
torch::str(filename));
In python, I got a runtime error when I tried to load the saved image from C++ code.
import torch
sample_file=f’./sample.img’
module = torch.jit.load(sample_file)
RuntimeError: version_number <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at /opt/conda/conda-bld/pytorch_1573049387353/work/caffe2/serialize/inline_container.cc:131, please report a bug to PyTorch. Attempted to read a PyTorch file with version 2, but the maximum supported version for reading is 1. Your PyTorch installation may be too old. (init at /opt/conda/conda-bld/pytorch_1573049387353/work/caffe2/serialize/inline_container.cc:131)