-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Fix torch.max
optional args dim
, keepdim
description
#147177
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/147177
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 97e01dc with merge base 93316cf ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/_torch_docs.py
Outdated
>>> a = torch.randn(3,1,3,) | ||
>>> a.max(dim=0, keepdim=True) | ||
torch.return_types.max( | ||
values=tensor([[[1.2928, 1.4774, 0.8201]]]), | ||
indices=tensor([[[2, 2, 1]]])) < 8000 /td> | ||
>>> a.max(dim=0, keepdim=False) | ||
torch.return_types.max( | ||
values=tensor([[1.2928, 1.4774, 0.8201]]), | ||
indices=tensor([[2, 2, 1]])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use an example that makes the behavior more clear. For example, construct an input tensor using torch.tensor()
with regular values. Integer values (e.g., 1.0, 2.0) make it easier to understand the behavior than random number with four decimal places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 2 jobs have failed, first few of them are: trunk / linux-focal-rocm6.3-py3.10 / test (default, 2, 2, linux.rocm.gpu.2), trunk / linux-focal-rocm6.3-py3.10 / test (distributed, 1, 1, linux.rocm.gpu.4) Details for Dev Infra teamRaised by workflow job |
@pytorchbot rebase -b main |
@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here |
Successfully rebased |
433898a
to
97e01dc
Compare
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
[`torch.max`](https://pytorch.org/docs/stable/generated/torch.max.html#torch.max) optional args `dim`, `keepdim` not described in document, but users can ignore them. ```python >>> import torch >>> a = torch.randn(3,1,3) >>> a.max() tensor(1.9145) >>> a.max(dim=1) torch.return_types.max( values=tensor([[ 1.1436, -0.0728, 1.3312], [-0.4049, 0.1792, -1.2247], [ 0.8767, -0.7888, 1.9145]]), indices=tensor([[0, 0, 0], [0, 0, 0], [0, 0, 0]])) ``` ## Changes - Add `optional` description for `dim`, `keepdim` - Add example of using `dim`, `keepdim` ## Test Result ### Before  ### After  Pull Request resolved: #147177 Approved by: https://github.com/colesbury
[`torch.max`](https://pytorch.org/docs/stable/generated/torch.max.html#torch.max) optional args `dim`, `keepdim` not described in document, but users can ignore them. ```python >>> import torch >>> a = torch.randn(3,1,3) >>> a.max() tensor(1.9145) >>> a.max(dim=1) torch.return_types.max( values=tensor([[ 1.1436, -0.0728, 1.3312], [-0.4049, 0.1792, -1.2247], [ 0.8767, -0.7888, 1.9145]]), indices=tensor([[0, 0, 0], [0, 0, 0], [0, 0, 0]])) ``` ## Changes - Add `optional` description for `dim`, `keepdim` - Add example of using `dim`, `keepdim` ## Test Result ### Before  ### After  Pull Request resolved: #147177 Approved by: https://github.com/colesbury
torch.max
optional argsdim
,keepdim
not described in document, but users can ignore them.Changes
optional
description fordim
,keepdim
dim
,keepdim
Test Result
Before
After