mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[TEST][CUDA] Use proper dtype in test_cuda_tensor_pow_scalar_tensor_cuda (#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: https://github.com/pytorch/pytorch/pull/163070 Approved by: https://github.com/eqy
This commit is contained in:
committed by
PyTorch MergeBot
parent
bb3f3cc65e
commit
5937861eba
@ -1480,8 +1480,8 @@ class TestBinaryUfuncs(TestCase):
|
||||
self.assertRaisesRegex(RuntimeError, regex, base.pow_, exponent)
|
||||
elif torch.can_cast(torch.result_type(base, exponent), base.dtype):
|
||||
actual2 = actual.pow_(exponent)
|
||||
self.assertEqual(actual, expected)
|
||||
self.assertEqual(actual2, expected)
|
||||
self.assertEqual(actual, expected.to(actual))
|
||||
self.assertEqual(actual2, expected.to(actual2))
|
||||
else:
|
||||
self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
|
Reference in New Issue
Block a user