OpenCV uses the channels-last memory format, so using:
torch::Tensor tensor = torch::from_blob(mat.data, { mat.channels(), mat.rows, mat.cols }, torch::kFloat);

would create an interleaved tensor and you should either permute the OpenCV matrix or create the tensor in a channels-last format and permute it afterwards.