I have an output tensor called output of shape [12000, 12000, 3] and of type uint8. It is a tensor of RGB values ranging in [0, 255]. I am trying to save it using the following line
torchvision.utils.save_image(output, "stitched_output.jpg")

But I get the following error:
----> 7 torchvision.utils.save_image(output, "stitched_output.jpg")

~/.local/lib/python3.6/site-packages/torchvision/utils.py in save_image(tensor, fp, nrow, padding, normalize, range, scale_each, pad_value, format)
    126                      normalize=normalize, range=range, scale_each=scale_each)
    127     # Add 0.5 after unnormalizing to [0, 255] to round to nearest integer
--> 128     ndarr = grid.mul(255).add_(0.5).clamp_(0, 255).permute(1, 2, 0).to('cpu', torch.uint8).numpy()
    129     im = Image.fromarray(ndarr)
    130     im.save(fp, format=format)

RuntimeError: result type Float can't be cast to the desired output type Byte

Any idea why this is happening? I never had issues before when it came to saving tensors as images. Thank you.