This should work to save a tensor in libtorch and load it in Python:
#include <torch/torch.h>
#include <iostream>

int main() {
  auto tensor = torch::ones({3, 3});
  auto bytes = torch::pickle_save(tensor);
  std::ofstream fout("lala.pt", std::ios::out | std::ios::binary);
  fout.write(bytes.data(), bytes.size());
  fout.close();
}

>>> import torch
>>> x = torch.load('lala.pt')
>>> x
tensor([[1., 1., 1.],
        [1., 1., 1.],
        [1., 1., 1.]])