Perhaps someone can help me with this. I’ve written a small network and I’d like to pass the output of this tensor to OpenCV to do some further image processing and pass the output of that back to a tensor which then is used in calculating the loss. Converting the tensors to cv::Mats and vice versa is not the problem, however, the weights don’t seem to update in the network and therefore doesn’t train. The gist of it is like so:

```
torch::Tensor prediction = net->forward(img_tensor);
cv::Mat prediction_vectors(cv::Size(512, 512), CV_32FC3, prediction.data_ptr());
// some image processing magic
cv::Mat someOutput = someImageProcessingMagic;
torch::Tensor newTensor = torch::from_blob(someOutput.data, { 1, 3, 512, 512 });
torch::Tensor loss = torch::mse_loss(newTensor, target);
```

Any help is appreciated.