What is difference between 'Tensor' and 'torch.Tensor'? : TypeError: pic should be Tensor or ndarray. Got <class 'torch.Tensor'>

I tried to modify the code to using multiple gpu. The code I fixed is as follows.

  netG_A2B = Generator_S2F(opt.input_nc, opt.output_nc)  # shadow to shadow_free
  netG_B2A = Generator_F2S(opt.output_nc, opt.input_nc)  # shadow_free to shadow
  netD_A = Discriminator(opt.input_nc)
  netD_B = Discriminator(opt.output_nc)

  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

  if (device.type == 'cuda') and (torch.cuda.device_count() > 1):
      print('Multi GPU')

   netG_A2B = torch.nn.DataParallel(netG_A2B)  # shadow to shadow_free
   netG_B2A = torch.nn.DataParallel(netG_B2A)  # shadow_free to shadow
   netD_A = torch.nn.DataParallel(netD_A)
   netD_B = torch.nn.DataParallel(netD_B)


  netG_A2B.to(device)
  netG_B2A.to(device)
  netD_A.to(device)
  netD_B.to(device)

original code is as follows.

  netG_A2B = Generator_S2F(opt.input_nc, opt.output_nc)  # shadow to shadow_free
  netG_B2A = Generator_F2S(opt.output_nc, opt.input_nc)  # shadow_free to shadow
  netD_A = Discriminator(opt.input_nc)
  netD_B = Discriminator(opt.output_nc)

  if opt.cuda:
      netG_A2B.cuda()
      netG_B2A.cuda()
      netD_A.cuda()
      netD_B.cuda()

and i got errors, the Traceback is this.

Traceback (most recent call last):
File “train_Mask-ShadowGAN.py”, line 207, in
print(mask_generator(real_A, fake_B))
File “/home/sonic/sw/Mask-ShadowGAN/utils.py”, line 39, in mask_generator
im_f = to_gray(to_pil(((shadow_free.data.squeeze(0) + 1.0) * 0.5).cpu()))
File “/home/sonic/.local/lib/python3.5/site-packages/torchvision/transforms/transforms.py”, line 110, in call
return F.to_pil_image(pic, self.mode)
File “/home/sonic/.local/lib/python3.5/site-packages/torchvision/transforms/functional.py”, line 103, in to_pil_image
raise TypeError(‘pic should be Tensor or ndarray. Got {}.’.format(type(pic)))
TypeError: pic should be Tensor or ndarray. Got <class ‘torch.Tensor’>.

I just modified the code and increased the batch size from 1 to 2.
What is difference between ‘Tensor’ and ‘torch.Tensor’?
and Why does the error occur?
Thank you.

There shouldn’t be a difference and the error message seems to be misleading.
Could you post the used transformations and the inputs you are passing to them?