Solved by ptrblck in post #6 
              
              
                You won’t be able to save it directly as an image, if it’s not a valid format. 
In case you want to store the output directly, you could use torch.save. On the other hand, you might want to store the predictions for each class as a color-coded image. 
In that case, you could get the predicted class …