Thanks. I tried with torch.load, but got following errors: UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xb3 in position 1: ordinal not in range(128)
RuntimeError: /sample.img is a zip archive (did you mean to use torch.jit.load()?)
And same errors persist when I changed my C++ code to save the image as below and use torch.load to load in python:
auto bytes = torch::jit::pickle_save(fake_img.cpu());
std::ofstream fout(“fake_img.img”, std::ios::out | std::ios::binary);
fout.write(bytes.data(), bytes.size());
fout.close();