Decode a PNG-encoded image

Does Pytorch have a function to decode a PNG image to a uint8 or uint16 tensor? I’m trying to track confusion matrix in tensorboard, and I found a way in Tensorflow to that converts the matplotlib plot specified by ‘figure’ to a PNG image, wanted to see if there was an equivalent for Pytorch.

I’m not sure to understand the question completely, so please feel free to correct my understanding.

PyTorch, or rather torchvision, uses PIL as the default library to load and manipulate images.
PIL is able to load PNG files and the numpy array can be transformed to a tensor afterwards.

You can store matplotlib images directly as PNGs using matplotlib.pyplot.savefig.

gotcha. Thanks for the help