mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
Optimize min
, max
gradient behavior description (#160312)
Fixes #160273 ## Test Result <img width="897" height="593" alt="image" src="https://github.com/user-attachments/assets/6ebcdb2c-8a2c-4f0d-8195-656089e88325" /> <img width="985" height="653" alt="image" src="https://github.com/user-attachments/assets/606a7264-e223-4d2b-8c3f-f153ce43b208" /> <img width="903" height="607" alt="image" src="https://github.com/user-attachments/assets/0ae2f56f-820f-4194-b15c-a02a078c0487" /> <img width="903" height="607" alt="image" src="https://github.com/user-attachments/assets/79c38a17-45ac-4808-829f-d538178de36b" /> Pull Request resolved: https://github.com/pytorch/pytorch/pull/160312 Approved by: https://github.com/ngimel
This commit is contained in:
committed by
PyTorch MergeBot
parent
45ba7ecda8
commit
fe3f5fe4ea
@ -6579,6 +6579,18 @@ max(input, *, out=None) -> Tensor
|
||||
|
||||
Returns the maximum value of all elements in the ``input`` tensor.
|
||||
|
||||
.. note::
|
||||
The difference between ``max``/``min`` and ``amax``/``amin`` is:
|
||||
- ``amax``/``amin`` supports reducing on multiple dimensions,
|
||||
- ``amax``/``amin`` does not return indices.
|
||||
|
||||
Both ``amax``/``amin`` evenly distribute gradients between equal values
|
||||
when there are multiple input elements with the same minimum or maximum value.
|
||||
|
||||
For ``max``/``min``:
|
||||
- If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values.
|
||||
- If reduce over one specified axis, only propagate to the indexed element.
|
||||
|
||||
Args:
|
||||
{input}
|
||||
|
||||
@ -6717,9 +6729,13 @@ dimension(s) :attr:`dim`.
|
||||
- ``amax``/``amin`` supports reducing on multiple dimensions,
|
||||
- ``amax``/``amin`` does not return indices.
|
||||
|
||||
Both ``max``/``min`` and ``amax``/``amin`` evenly distribute gradients between equal values
|
||||
Both ``amax``/``amin`` evenly distribute gradients between equal values
|
||||
when there are multiple input elements with the same minimum or maximum value.
|
||||
|
||||
For ``max``/``min``:
|
||||
- If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values.
|
||||
- If reduce over one specified axis, only propagate to the indexed element.
|
||||
|
||||
{keepdim_details}
|
||||
|
||||
Args:
|
||||
@ -7197,6 +7213,18 @@ min(input, *, out=None) -> Tensor
|
||||
|
||||
Returns the minimum value of all elements in the :attr:`input` tensor.
|
||||
|
||||
.. note::
|
||||
The difference between ``max``/``min`` and ``amax``/``amin`` is:
|
||||
- ``amax``/``amin`` supports reducing on multiple dimensions,
|
||||
- ``amax``/``amin`` does not return indices.
|
||||
|
||||
Both ``amax``/``amin`` evenly distribute gradients between equal values
|
||||
when there are multiple input elements with the same minimum or maximum value.
|
||||
|
||||
For ``max``/``min``:
|
||||
- If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values.
|
||||
- If reduce over one specified axis, only propagate to the indexed element.
|
||||
|
||||
Args:
|
||||
{input}
|
||||
|
||||
@ -7325,9 +7353,13 @@ dimension(s) :attr:`dim`.
|
||||
- ``amax``/``amin`` supports reducing on multiple dimensions,
|
||||
- ``amax``/``amin`` does not return indices.
|
||||
|
||||
Both ``max``/``min`` and ``amax``/``amin`` evenly distribute gradients between equal values
|
||||
Both ``amax``/``amin`` evenly distribute gradients between equal values
|
||||
when there are multiple input elements with the same minimum or maximum value.
|
||||
|
||||
For ``max``/``min``:
|
||||
- If reduce over all dimensions(no dim specified), gradients evenly distribute between equally ``max``/``min`` values.
|
||||
- If reduce over one specified axis, only propagate to the indexed element.
|
||||
|
||||
{keepdim_details}
|
||||
|
||||
Args:
|
||||
|
Reference in New Issue
Block a user