title: RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
body: <p>I set my model and data to the same device, but always raise the error like this:</p>
  
  <blockquote>
    <p>RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same</p>
  </blockquote>
  
  <p>The following is my training code, I hope you can answer it.Thanks!</p>
  
  <pre><code>def train(train_img_path, train_label_path, pths_path, interval, log_file):
  
      file_num = len(os.listdir(train_img_path))
      device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
      net = EAST(extractor=extractor, geometry_mode=geometry_mode, pretrained=True)
      net = net.to(device)
      trainset = custom_dataset(train_img_path, train_label_path)
      train_loader = data.DataLoader(trainset, batch_size=batch_size,
                                     shuffle=True, num_workers=num_workers, drop_last=True)
  
  
      optimizer = optim.SGD(net.parameters(), lr=initial_lr, momentum=momentum, weight_decay=weight_decay_sgd)
      criterion = Loss(weight_geo, weight_angle, geometry_mode="RBOX")
  
      net.train()
      epoch_loss = 0.
      for epoch in range(max_epoch):
          epoch_time = time.time()
          for i, (img, score_gt, geo_gt, ignored_map) in enumerate(train_loader):
              start_time = time.time()
              img, score_gt, geo_gt, ignored_map = img.to(device), score_gt.to(device),\
                                                   geo_gt.to(device), ignored_map.to(device)
  
              score_pred, geo_pred = net(img)
              total_loss, score_loss, loss_AABB, loss_angle = criterion(score_pred, geo_pred, score_gt, geo_gt, ignored_map)
  
  
              epoch_loss += total_loss.item()
  
              optimizer.zero_grad()
              total_loss.backward()
  
              optimizer.step()
  </code></pre>