title: Trying to access subset of mnist dataset in pytorch [equal samples from each class]
body: <p>Trying to access subset of mnist dataset in pytorch [equal samples from each class] but getting this error</p>
  <pre><code>prng = RandomState(42)
  random_permute = prng.permutation(np.arange(0, 6000))[0:3000]
  indx = np.concatenate([np.where(np.array(mnist_data.targets) == classe)[0][random_permute] for classe in range(0,10)])
  </code></pre>
  <pre><code>---------------------------------------------------------------------------
  IndexError                                Traceback (most recent call last)
  &lt;ipython-input-178-038015f76b77&gt; in &lt;module&gt;
  ----&gt; 1 indx = np.concatenate([np.where(np.array(mnist_data.targets) == classe)[0][random_permute] for classe in range(0,10)])
  
  &lt;ipython-input-178-038015f76b77&gt; in &lt;listcomp&gt;(.0)
  ----&gt; 1 indx = np.concatenate([np.where(np.array(mnist_data.targets) == classe)[0][random_permute] for classe in range(0,10)])
  
  IndexError: index 5992 is out of bounds for axis 0 with size 5923
  </code></pre>