This is actually what I am doing for now:
std::vector<cv::Mat> heatMaps(heatMapsTensor.size(0));

	for (size_t i = 0; i < heatMaps.size(); i++) {
	  torch::Tensor one_heat_map = heatMapsTensor[i];
	  cv::Mat one_mat(heatMapsTensor.size(1), heatMapsTensor.size(2), CV_32FC1);
	  std::memcpy(one_mat.data, one_heat_map.data<float>(), sizeof(float) * one_heat_map.numel());
	  heatMaps[i] = one_mat;
	}

I just saw this usage tensor_a.data<float>() which seems a clue so I changed to this but still not right.
I am trying another thread:
get the tensor pointer say float* p, then copy it’s data to cv::Mat. However, how should I get the point of a tensor ? using tensor_a.data_ptr()? But that is (void*) not what I need float*