title: How to sort a dataset in pytorch
body: <p>I would like to sort my dataset by the numerical values in the labels. </p>
  
  <p>Is there a function from pytorch to handle this efficiently? </p>
  
  <p>my dataset <code>type()</code> is in this from:</p>
  
  <pre><code> &lt;class 'torchvision.datasets.mnist.MNIST'&gt;
  </code></pre>