-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
add paddle.gcd and paddle.lcm #37819
Conversation
✅ This PR's description meets the template requirements! |
Thanks for your contribution! |
from .math import gcd # noqa: F401 | ||
from .math import lcm # noqa: F401 |
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.
shall we add gcd and lcm in tensor_method_func below ?
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.
done
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
gcd(0,0)=0, gcd(0, y)=|y| | ||
|
||
Args: | ||
x, y (Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8. |
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.
x, y 各起一行写会好一点
.. code-block:: python | ||
|
||
import paddle | ||
import numpy as np |
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.
这里不引入 numpy
# Tensor(shape=[1], dtype=int64, place=CUDAPlace(0), stop_gradient=True, | ||
# [4]) | ||
|
||
x3 = paddle.to_tensor(np.arange(6)) |
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.
x3 = paddle.arange(6)
lcm(0,0)=0, lcm(0, y)=0 | ||
|
||
Args: | ||
x, y (Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8. |
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.
同上
.. code-block:: python | ||
|
||
import paddle | ||
import numpy as np |
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.
同上
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.
TODO:Fix API Docs
好的,会在下一个PR专门修改文档 |
PR types
New features
PR changes
APIs
Describe