                  new_data[i] = image.imresize(data[i], resize, resize)
              data = new_data
          # change data from batch x height x weight x channel to batch x channel x height x weight
          return nd.transpose(data.astype('float32'), (0,3,1,2))/255, label.astype('float32')
      mnist_train = gluon.data.vision.FashionMNIST(root=root, train=True, transform=transform_mnist)
      mnist_test = gluon.data.vision.FashionMNIST(root=root, train=False, transform=transform_mnist)
      train_data = DataLoader(mnist_train, batch_size, shuffle=True)
      test_data = DataLoader(mnist_test, batch_size, shuffle=False)
      return (train_data, test_data)
  
  def try_gpu():
      """If GPU is available, return mx.gpu(0); else return mx.cpu()"""
      try:
 
</s> remove     def __init__(self, dataset, batch_size, shuffle):
 </s> add     def __init__(self, dataset, batch_size, shuffle, transform): </s> remove             yield (X[i*self.batch_size:(i+1)*self.batch_size],
                   y[i*self.batch_size:(i+1)*self.batch_size])
 </s> add             if self.transform is not None:
                yield self.transform(X[i*self.batch_size:(i+1)*self.batch_size], 
                                     y[i*self.batch_size:(i+1)*self.batch_size])
            else:
                yield (X[i*self.batch_size:(i+1)*self.batch_size],
                       y[i*self.batch_size:(i+1)*self.batch_size])
    
    mnist_train = gluon.data.vision.FashionMNIST(root=root, train=True, transform=None)
    mnist_test = gluon.data.vision.FashionMNIST(root=root, train=False, transform=None)
    train_data = DataLoader(mnist_train, batch_size, shuffle=True, transform = transform_mnist)
    test_data = DataLoader(mnist_test, batch_size, shuffle=False, transform = transform_mnist)
                  new_data[i] = image.imresize(data[i], resize, resize)
              data = new_data
          # change data from batch x height x weight x channel to batch x channel x height x weight
          return nd.transpose(data.astype('float32'), (0,3,1,2))/255, label.astype('float32')
    
    mnist_train = gluon.data.vision.FashionMNIST(root=root, train=True, transform=None)
    mnist_test = gluon.data.vision.FashionMNIST(root=root, train=False, transform=None)
    train_data = DataLoader(mnist_train, batch_size, shuffle=True, transform = transform_mnist)
    test_data = DataLoader(mnist_test, batch_size, shuffle=False, transform = transform_mnist)
    
    mnist_train = gluon.data.vision.FashionMNIST(root=root, train=True, transform=None)
    mnist_test = gluon.data.vision.FashionMNIST(root=root, train=False, transform=None)
    train_data = DataLoader(mnist_train, batch_size, shuffle=True, transform = transform_mnist)
    test_data = DataLoader(mnist_test, batch_size, shuffle=False, transform = transform_mnist)
    
    mnist_train = gluon.data.vision.FashionMNIST(root=root, train=True, transform=None)
    mnist_test = gluon.data.vision.FashionMNIST(root=root, train=False, transform=None)
    train_data = DataLoader(mnist_train, batch_size, shuffle=True, transform = transform_mnist)
    test_data = DataLoader(mnist_test, batch_size, shuffle=False, transform = transform_mnist)
    
    mnist_train = gluon.data.vision.FashionMNIST(root=root, train=True, transform=None)
    mnist_test = gluon.data.vision.FashionMNIST(root=root, train=False, transform=None)
    train_data = DataLoader(mnist_train, batch_size, shuffle=True, transform = transform_mnist)
    test_data = DataLoader(mnist_test, batch_size, shuffle=False, transform = transform_mnist)
      return (train_data, test_data)
  
  def try_gpu():
      """If GPU is available, return mx.gpu(0); else return mx.cpu()"""
      try:
keep keep keep keep replace replace replace replace keep keep keep keep keep
 fix for resize to 224 when training AlextNet in alexnet-gluon.md 
utils.py