No,  you have to make sure your data is on the CPU.
Also, even if you train your model on the GPU, all you have to do is shift the output tensor to the cpu and store the images. Here is a minimal Example
model.cuda()
output = model(input)
output = output.cpu().numpy()
cv2.imwrite(output, 'pic.png')