I have a cv::Mat which is CV_32SC3 type, it stores both positive and negative values.
When convert it to tensor, the values are messed up:
cout << in_img << endl;

 auto tensor_image = torch::from_blob(in_img.data, {1, in_img.rows, in_img.cols, 3}, torch::kByte);

The in_img has negative values, while after print out tensor_image, the values were all totally different than in_img.
the negative values are gone (it somehow seems to normilise it 255 range). I tried converting to Long like so:
auto tensor_image = torch::from_blob(in_img.data, {1, in_img.rows, in_img.cols, 3}, torch::kLong);

but when I print the values like so, I get seg fault:
  std::cout << "tensor_image: " << tensor_image << " values." << std::endl;

so, I tried looking at just the first element like so:
std::cout << "input_tensor[0][0][0][0]: " << tensor_image[0][0][0][0] << " values." << std::endl;

and the value is not the same as I see in the python implementation :((