-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add the max, min, maximum, minimum api for the API 2.0 #25580
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
Thanks for your contribution! |
import paddle.fluid.core as core | ||
|
||
|
||
class ApiMaxTest(unittest.TestCase): |
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.
Min
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.
fixed it
import paddle.fluid.core as core | ||
|
||
|
||
class ApiMaximumTest(unittest.TestCase): |
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.
Minimum
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.
fixed it
python/paddle/tensor/math.py
Outdated
user to set this property. For more information, please refer to :ref:`api_guide_Name` | ||
|
||
Returns: | ||
Variable: Tensor, results of maximum on the specified dim of input tensor, | ||
Variable: Tensor, results of maximum on the specified axis of input tensor, |
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.
是否能返回一个二元组,对齐sort和argsort(最大值, indices)
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.
目前确认不返回index信息
'reduce_all': reduce_all | ||
}) | ||
return out | ||
|
||
|
||
def min(input, dim=None, keep_dim=False, out=None, name=None): | ||
def min(x, axis=None, keepdim=False, name=None): |
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.
是否能返回一个二元组?对齐sort和argsort(最小值, indices)
… fix_max_min_api
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.
LGTM
python/paddle/tensor/math.py
Outdated
@@ -1116,152 +1219,185 @@ def _check_input(input): | |||
return out | |||
|
|||
|
|||
def max(input, dim=None, keep_dim=False, name=None): | |||
def max(x, axis=None, keepdim=False, name=None): | |||
""" | |||
:alias_main: paddle.max | |||
:alias: paddle.max,paddle.tensor.max,paddle.tensor.math.max |
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.
可以不写alias这两行了 辛苦删掉吧
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.
LGTM
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.
LGTM
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.
LGTM
PR types
Bug fixes
PR changes
APIs
Describe
Add the max, min, maximum, minimum api for the API 2.0