Skip to content

[ONNX] Fix numpy method to return the correct type (#136162) #136203

Merged
kit1980 merged 2 commits intopytorch:release/2.5from
justinchuby:justinchu/pt25-numpy-method-pick
Sep 20, 2024
Merged

[ONNX] Fix numpy method to return the correct type (#136162) #136203
kit1980 merged 2 commits intopytorch:release/2.5from
justinchuby:justinchu/pt25-numpy-method-pick

Conversation

@justinchuby
Copy link
Collaborator

No description provided.

Previous implementation of the `numpy()` method returns `fp64` when the tensor is `fp32`. This is unexpected but seems to be caused by calling `__array__(dtype=None)` on the numpy array. I updated the implementation to implement the `numpy()` method explicitly and added tests to guard the behavior.

This needs to be cherry-picked into torch 2.5
Pull Request resolved: pytorch#136162
Approved by: https://github.com/gramalingam, https://github.com/xadupre

(cherry picked from commit 67b14ce)
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 17, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/136203

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure

As of commit dd76e40 with merge base b7eb725 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the release notes: onnx torch.onnx related changes that should show up in the release notes label Sep 17, 2024
@kit1980 kit1980 merged commit fb276d2 into pytorch:release/2.5 Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open source release notes: onnx torch.onnx related changes that should show up in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants