Solved by Umair_Javaid in post #2 
              
              
                fixed it by returning x.to(device): 
def preprocess_input(img):
  print(img.shape)
  x = data_preprocess(img)
  x.unsqueeze_(0)
  #x.to(device)
  print("x.size(): ",x.size(),x.type())
  return x.to(device)