title: PyTorch Datasets: Converting entire Dataset to NumPy
body: <p>I'm trying to convert the Torchvision MNIST train and test datasets into NumPy arrays but can't find documentation to actually perform the conversion. </p>
  
  <p>My goal would be to take an entire dataset and convert it into a single NumPy array, preferably without iterating through the entire dataset.</p>
  
  <p>I've looked at <a href="https://stackoverflow.com/questions/51756581/how-do-i-turn-a-pytorch-dataloader-into-a-numpy-array-to-display-image-data-with">How do I turn a Pytorch Dataloader into a numpy array to display image data with matplotlib?</a> but it doesn't address my issue. </p>
  
  <p>So my question is, utilizing <code>torch.utils.data.DataLoader</code>, how would I go about converting the datasets (train/test) into two NumPy arrays such that all of the examples are present? </p>
  
  <p>Note: I've left the batch size as the default of 1 for now; I could set it to 60,000 for train and 10,000 for test, but I'd prefer to not use magic numbers of that sort.</p>
  
  <p>Thank you.</p>