Best and Worst reconstructed images/data from an Autoencoder

I use an autoencoder model to encode and decode data matrices(instead of starting with images) of a variable (velocity) in a flow field. I would, now, like to extract the samples from the complete dataset that have been best and worst reconstructed in that last epoch. Is there a specific inbuilt function in torch to already do this or do I need to calculate the error for every sample during the last epoch?
Thank you.

I don’t think PyTorch will automatically track any metrics for you so you would need to compute the error and use these stats to get the corresponding samples.

Thank you for the answer. Yes, I computed what I needed on my own.