Solved by Matej_Kompanek in post #2 
              
              
                I would guess that cv::Mat is trying to access memory on GPU (gt and pr are both referring to CUDA memory). Before calling ‘data_ptr()’, copy outputs and tensors back to CPU, e.g.: 
		targets = targets.cpu().contiguous();
		outputs = outputs.cpu().contiguous();