I use Libtorch 1.8.1(LTS)+cpu version and try to run the simplest example in Visual Studio 2019:
#include <torch/torch.h>
#include <iostream>
int main() {
    auto tensor = torch::ones({3, 4});
    torch::save(tensor, "ones.pt");
    return 0;
}

Then it runs into error…
Uncaught exception: Microsoft C++ exception std::bad_alloc

and  it points to libtorch\include\torch\csrc\api\include\torch\serialize\torch.h line 10
inline serialize::OutputArchive& operator<<(
    serialize::OutputArchive& archive,
    const Tensor& tensor) {
    archive.write("0", tensor); // line 10
    return archive;
}