title: I am getting Attribute error as 'int' object has no attribute 'to'
body: <p>I am writing a python code in Kaggle notebook for Image Classification. In the training part, I am getting an error </p>
  
  <pre><code>AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-22-052723d8ce9d&gt; in &lt;module&gt;
        5     test_loss = 0.0
        6     for images,label in enumerate(train_loader):
  ----&gt; 7         images,label = images.to(cuda),label.to(cuda)
        8         optimizer.zero_grad()
        9 
  
  AttributeError: 'int' object has no attribute 'to'
  </code></pre>
  
  <p>This is the following code, (I am giving only 2 parts, pls tell if you need more)</p>
  
  <pre><code>train_loader = torch.utils.data.DataLoader(train_data,batch_size = 128,num_workers =0,shuffle =True)
  test_loader = torch.utils.data.DataLoader(test_data,batch_size = 64,num_workers =0,shuffle =False)
  
  
  epoch = 10
  
  for e in range(epoch):
      train_loss = 0.0
      test_loss = 0.0
      for images,label in enumerate(train_loader):
          images,label = images.to(cuda),label.to(cuda)
          optimizer.zero_grad()
  
          output = model(images)
          _,predict = torch.max(output.data, 1)
          loss = criterion(output,labels)
          loss.backward()
          optimizer.step()
  
          train_loss += loss.item()
          train_size += label.size(0)
          train_success += (predict==label).sum().item()
  
  
          print("train_accuracy is {.2f}".format(100*(train_success/train_size)) )
  </code></pre>