Skip to content

Commit 5937861

Browse files
Aidyn-Apytorchmergebot
authored andcommitted
[TEST][CUDA] Use proper dtype in test_cuda_tensor_pow_scalar_tensor_cuda (pytorch#163070)
The test `test_binary_ufuncs.py::TestBinaryUfuncsCUDA::test_cuda_tensor_pow_scalar_tensor_cuda` fails with a mismatched `dtype`: ```Python AssertionError: The values for attribute 'dtype' do not match: torch.float32 != torch.float64. ``` This PR forces both arguments to use the same `dtype` to fix the test failure. Pull Request resolved: pytorch#163070 Approved by: https://github.com/eqy
1 parent bb3f3cc commit 5937861

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/test_binary_ufuncs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,8 +1480,8 @@ def to_np(value):
14801480
self.assertRaisesRegex(RuntimeError, regex, base.pow_, exponent)
14811481
elif torch.can_cast(torch.result_type(base, exponent), base.dtype):
14821482
actual2 = actual.pow_(exponent)
1483-
self.assertEqual(actual, expected)
1484-
self.assertEqual(actual2, expected)
1483+
self.assertEqual(actual, expected.to(actual))
1484+
self.assertEqual(actual2, expected.to(actual2))
14851485
else:
14861486
self.assertRaisesRegex(
14871487
RuntimeError,

0 commit comments

Comments
 (0)