I fixed your issue, see a new notebook here:

  
      github.com
  
  
    QuantScientist/quoniammm/blob/master/CNN_minist.ipynb 29
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import torch\n",
    "from torch.autograd import Variable\n",
    "import torch.nn as nn\n",
    "import torch.nn.functional as F\n",
    "import torch.utils.data as Data\n",
    "import torchvision\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",


  This file has been truncated. show original

  
  
    
    
  
  


You needed:
train_data = np.array(train_data, dtype=np.float32)  
valid_data = np.array(valid_data, dtype=np.float32)

You now have a new error, but that would be easy to fix.
Best,