Sorry my fault.  The problem line was:
auto img_tensor = torch::from_blob(img_float.data, { img_float.rows, img_float.cols, 3 }).to(torch::kCUDA);

I changed this to:
auto img_tensor = torch::from_blob(img_float.data, { img_float.rows, img_float.cols, 3 });

This prevented the error from happening.  However, I still do not get the same output.
Python:

Python973×483 17.9 KB

Cpp:

Cpp979×512 14.9 KB

I suppose at this point it could be that my input tensors are not the same, or that I have made an error exporting to Torchscript (which I doubt, since I simply followed the example in the official documentation).