Skip to content

[release/2.6] Update test_binary_ufuncs.py after numpy upgrade #2287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2025

Conversation

ethanwee1
Copy link

@ethanwee1 ethanwee1 commented Jun 19, 2025

Fixes https://ontrack-internal.amd.com/browse/SWDEV-538110
Related to f309230
Not a Navi specific failure:

  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/testing/_internal/common_device_type.py", line 1412, in only_fn
    return fn(slf, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/jenkins/pytorch/test/test_binary_ufuncs.py", line 1671, in test_cuda_tensor_pow_scalar_tensor
    self._test_pow(base, exp)
  File "/var/lib/jenkins/pytorch/test/test_binary_ufuncs.py", line 1482, in _test_pow
    self.assertEqual(actual, expected)
  File "/opt/conda/envs/py_3.12/lib/python3.12/site-packages/torch/testing/_internal/common_utils.py", line 4052, in assertEqual
    raise error_metas.pop()[0].to_error(
AssertionError: The values for attribute 'dtype' do not match: torch.float32 != torch.float64.

Using .to(actual) without specifying dtype/device assumes actual is a tensor or tensor-like, which may fail silently or promote. Fixed by explicitly matching dtype and device
Going from pytorch#107302
Fix:

root@ubb4-rack-22:/var/lib/jenkins/pytorch# TEST_CONFIG=default HIP_VISIBLE_DEVICES=0 PYTORCH_TEST_WITH_ROCM=1 python test/test_binary_ufuncs.py TestBinaryUfuncsCUDA.test_cuda_tensor_pow_scalar_tensor_cuda
/opt/conda/envs/py_3.12/lib/python3.12/site-packages/hypothesis/entry_points.py:23: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  import pkg_resources

Running tests...
----------------------------------------------------------------------
.
----------------------------------------------------------------------
Ran 1 test in 0.141s

OK

Generating XML reports...
root@ubb4-rack-22:/var/lib/jenkins/pytorch# pip list | grep numpy
numpy                   2.1.2

@ethanwee1 ethanwee1 marked this pull request as ready for review June 19, 2025 21:02
@rocm-repo-management-api
Copy link

rocm-repo-management-api bot commented Jun 19, 2025

Jenkins build for 53e606cb22787b76a4c639ce0d28bfdedf2dc14d commit finished as FAILURE
Links: Blue Ocean view / Build artifacts

@rocm-repo-management-api
Copy link

rocm-repo-management-api bot commented Jul 1, 2025

Jenkins build for c5b3bdb47ebe821b434e1fe5b48ab39e60623584 commit finished as FAILURE
Links: Blue Ocean view / Build artifacts

@jithunnair-amd jithunnair-amd merged commit 6812457 into release/2.6 Jul 7, 2025
2 of 6 checks passed
@jithunnair-amd jithunnair-amd deleted the release2.6_numpy_dtype branch July 7, 2025 16:03
@jithunnair-amd jithunnair-amd changed the title [release/2.6] Numpy dtype change [release/2.6] Update test_binary_ufuncs.py after numpy upgrade Jul 7, 2025
@jithunnair-amd
Copy link
Collaborator

jithunnair-amd commented Jul 7, 2025

Unintentionally did "Rebase and Merge", so squashed commits into ea75c6e and force pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants