Skip to content

[AUTOGENERATED] [release/2.7] [release/2.6] Fix dtype before comparing torch and numpy tensors#2362

Merged
pruthvistony merged 1 commit intorelease/2.7from
autogenerated/release/2.7_cherry-pick_pr-2340
Jul 15, 2025
Merged

[AUTOGENERATED] [release/2.7] [release/2.6] Fix dtype before comparing torch and numpy tensors#2362
pruthvistony merged 1 commit intorelease/2.7from
autogenerated/release/2.7_cherry-pick_pr-2340

Conversation

@okakarpa
Copy link
Copy Markdown
Collaborator

Cherry-pick of #2340

Cast numpy dtype result to torch dtype result before compare

Numpy returns `np.power(float32, int64) => float64` [Promotion rules for
Python scalars](https://numpy.org/neps/nep-0050-scalar-promotion.html)
Pytorch returns `torch.pow(float32, int64) => float32`

Reverts #2287 and fixes tests in a
different way

Fixes:
- SWDEV-538110 - `'dtype' do not match: torch.float32 != torch.float64`
> -
test_binary_ufuncs.py::TestBinaryUfuncsCUDA::test_cuda_tensor_pow_scalar_tensor_cuda
- SWDEV-539171 - `AttributeError: 'float' object has no attribute
'dtype`
> -
test_binary_ufuncs.py::TestBinaryUfuncsCUDA::test_long_tensor_pow_floats_cuda
> -
test_binary_ufuncs.py::TestBinaryUfuncsCUDA::test_complex_scalar_pow_tensor_cuda_*
> -
test_binary_ufuncs.py::TestBinaryUfuncsCUDA::test_float_scalar_pow_float_tensor_cuda_*
@ethanwee1 ethanwee1 marked this pull request as ready for review July 14, 2025 19:00
@ethanwee1 ethanwee1 self-requested a review July 14, 2025 19:00
@rocm-repo-management-api
Copy link
Copy Markdown

rocm-repo-management-api Bot commented Jul 14, 2025

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

@pruthvistony pruthvistony merged commit 22c98ea into release/2.7 Jul 15, 2025
0 of 5 checks passed
@pruthvistony pruthvistony deleted the autogenerated/release/2.7_cherry-pick_pr-2340 branch July 15, 2025 16:54
pragupta pushed a commit that referenced this pull request Jul 21, 2025
…g torch and numpy tensors (#2362)

Cherry-pick of #2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
pragupta pushed a commit to pragupta/pytorch that referenced this pull request Jul 21, 2025
…g torch and numpy tensors (ROCm#2362)

Cherry-pick of ROCm#2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
pragupta pushed a commit that referenced this pull request Jul 22, 2025
…g torch and numpy tensors (#2362)

Cherry-pick of #2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
jithunnair-amd pushed a commit that referenced this pull request Jul 22, 2025
…g torch and numpy tensors (#2362)

Cherry-pick of #2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
pragupta pushed a commit that referenced this pull request Jul 29, 2025
…g torch and numpy tensors (#2362)

Cherry-pick of #2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
pragupta pushed a commit that referenced this pull request Oct 8, 2025
…g torch and numpy tensors (#2362)

Cherry-pick of #2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
(cherry picked from commit 2d72fcd)
jithunnair-amd pushed a commit that referenced this pull request Oct 10, 2025
…g torch and numpy tensors (#2362)

Cherry-pick of #2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
(cherry picked from commit 2d72fcd)
jeffdaily pushed a commit that referenced this pull request Nov 17, 2025
…g torch and numpy tensors (#2362)

Cherry-pick of #2340

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
(cherry picked from commit 22c98ea)
(cherry picked from commit 2d72fcd)
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.

4 participants