for epoch_index in range(cfg.epoch):
for train_batch_index, (img_batch, label_batch) in enumerate (zip (train_loader, valid_loader )):
 img_batch, label_batch = img_batch[0], img_batch[1]
 img_batch_v, label_batch_v = label_batch[0], label_batch[1]

 img_batch = variable(img_batch)
 label_batch = variable(label_batch).unsqueeze(dim=1)

 img_batch_v = variable(img_batch_v)
 label_batch_v = variable(label_batch_v).unsqueeze(dim=1)

 predict, reconstruct_img = net(img_batch, label_batch, train=True)
 acc = net.calc_acc(predict, label_batch)
 margin_loss = net.margin_loss(predict, label_batch)
 reconstruct_loss = net.reconstruction_loss(img_batch, reconstruct_img) 
 Custom_loss = custom_lossl(img_batch, img_batch_v)

 loss = margin_loss + reconstruct_loss +Custom_loss
 net.zero_grad()
 loss.backward()
 opt.step()

But got the error:
File “main_mahfuj.py”, line 95, in 
img_batch_v = variable(img_batch_v)
File “/media/mahfuj/DATA/New_CODE/Working/CapsNet_pytorch/lib/cuda_utils.py”, line 7, in variable
return Variable(tensor, volatile=volatile).cuda()
RuntimeError: Variable data has to be a tensor, but got int
I got the value of img_batch but I did not get the value of img_batch_v.
Thanks in advanced.