Replace legacy tensor.Tensor with torch.tensor/torch.empty (#12027)

* Replace legacy torch.Tensor constructor with torch.{tensor, empty}

* Remove torch.Tensor in examples
This commit is contained in:
Mario Šaško
2021-06-08 05:58:38 -07:00
committed by GitHub
parent e33085d648
commit f5eec0d8e9
13 changed files with 26 additions and 22 deletions

View File

@@ -556,6 +556,6 @@ class CLIPModelIntegrationTest(unittest.TestCase):
torch.Size((inputs.input_ids.shape[0], inputs.pixel_values.shape[0])),
)
expected_logits = torch.Tensor([[24.5056, 18.8076]]).to(torch_device)
expected_logits = torch.tensor([[24.5056, 18.8076]], device=torch_device)
self.assertTrue(torch.allclose(outputs.logits_per_image, expected_logits, atol=1e-3))