Skip to content

Commit

Permalink
Fix device issue in `SwiftFormerModelIntegrationTest::test_inference_…
Browse files Browse the repository at this point in the history
…image_classification_head` (huggingface#23435)

fix

Co-authored-by: ydshieh <[email protected]>
  • Loading branch information
ydshieh and ydshieh authored May 17, 2023
1 parent 0f2c738 commit a8732e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/models/swiftformer/test_modeling_swiftformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,5 @@ def test_inference_image_classification_head(self):
expected_shape = torch.Size((1, 1000))
self.assertEqual(outputs.logits.shape, expected_shape)

expected_slice = torch.tensor([[-2.1703e00, 2.1107e00, -2.0811e00]])
expected_slice = torch.tensor([[-2.1703e00, 2.1107e00, -2.0811e00]]).to(torch_device)
self.assertTrue(torch.allclose(outputs.logits[0, :3], expected_slice, atol=1e-4))

0 comments on commit a8732e0

Please sign in to comment.