libtorch(版本1.7)读取pytorch(版本1.4)中存的tensor时,报错PytorchStreamReader failed reading zip archive: failed finding central directory
save的代码:

torch.save(cur_tensor, "cur_tensor.pt")

尝试了网上的方法:

torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=False)
# or torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=True)

还是会报错。
尝试将pytorch版本也换成1.7,并且用

torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=True)

保存,libtorch可以正常读取了

libtorch(版本1.7)读取pytorch(版本1.4)中存的tensor时,报错PytorchStreamReader failed reading zip archive: failed finding central directory
save的代码:

torch.save(cur_tensor, "cur_tensor.pt")

尝试了网上的方法:

torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=False)
# or torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=True)

还是会报错。
尝试将pytorch版本也换成1.7,并且用

torch.save(cur_tensor, "cur_tensor.pt", _use_new_zipfile_serialization=True)

保存,libtorch可以正常读取了