@rishabh135 if you load your images as a 4D numpy array and labels as 2D numpy array, you can do:
inputs = Variable(torch.from_numpy(images)).float().cuda()
targets = Variable(torch.from_numpy(labels)).long().cuda()

Be careful that some loss functions requires float for target, so you might want to change it to:
targets = Variable(torch.from_numpy(labels)).float().cuda()