Please help, I try to create tensor from array using torch::from_blob
but the tensor value is different than the array, here is my code:
double cost_matrix_value[4][4] = {{9, 2, 7, 8},
{6, 4, 3, 7},
{6, 8, 1, 8},
{7, 6, 9, 4}};
auto cost_matrix = torch::from_blob(cost_matrix_value, {4, 4});
at::print(cost_matrix);
The result is
0.0000 2.5312 0.0000 2.0000
0.0000 2.4375 0.0000 2.5000
0.0000 2.3750 0.0000 2.2500
0.0000 2.1250 0.0000 2.4375
[ Variable[CPUFloatType]{4,4} ]