Conversion of 2d and 4d vectors in c++ to torch tensor doesn't have the right data

I’m trying to convert these two vectors to torch tensor but the output doesn’t have the right data:

auto input_options = torch::TensorOptions().dtype(torch::kInt32);
auto inputs = torch::from_blob(vec.data(), {1, 10, 194, 144}, input_options);

output:

..Columns 13 to 18 -8.0412e+08  9.1974e+08  4.9000e+01  0.0000e+00  1.6578e+09  2.1909e+04
  1.6578e+09  2.1909e+04  1.6581e+09  2.1909e+04  1.6559e+09  2.1909e+04
  1.8698e+09  1.9702e+09  7.5708e+08  1.7000e+09  1.9199e+09  0.0000e+00
  1.9704e+09  1.8524e+09  1.7017e+09  5.3978e+08  1.9366e+09  5.4103e+08..

also

std::vector<std::vector <int>> indx1={{126, 22}, {166, 102}, {46, 46}, {166, 54} };
auto indx_options = torch::TensorOptions().dtype(torch::kInt32);
 auto indx = torch::from_blob(indx1.data(), { indx1.size(),2}, indx_options);

output:

 1.1586e+09  2.2036e+04
 1.1586e+09  2.2036e+04
 1.1586e+09  2.2036e+04
 1.1586e+09  2.2036e+04
[ CPUIntType{4,2} ]

Are the source arrays going out of scope? If so, .clone() the tensor before the underlying data is freed.

Thanks for your respond. I added .clone() but still got the same result.
Using arrays instead of vectors has solved the problem.