Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
698fca80
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
698fca80
编写于
12月 11, 2021
作者:
T
Tao Luo
提交者:
GitHub
12月 11, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine gcd & lcm docs (#38029)
上级
65494051
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
8 deletion
+10
-8
python/paddle/tensor/math.py
python/paddle/tensor/math.py
+10
-8
未找到文件。
python/paddle/tensor/math.py
浏览文件 @
698fca80
...
@@ -2796,9 +2796,11 @@ def gcd(x, y, name=None):
...
@@ -2796,9 +2796,11 @@ def gcd(x, y, name=None):
Note:
Note:
gcd(0,0)=0, gcd(0, y)=|y|
gcd(0,0)=0, gcd(0, y)=|y|
If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
Args:
Args:
x
, y
(Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8.
x (Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8.
If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
y (Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Returns:
...
@@ -2808,7 +2810,6 @@ def gcd(x, y, name=None):
...
@@ -2808,7 +2810,6 @@ def gcd(x, y, name=None):
.. code-block:: python
.. code-block:: python
import paddle
import paddle
import numpy as np
x1 = paddle.to_tensor(12)
x1 = paddle.to_tensor(12)
x2 = paddle.to_tensor(20)
x2 = paddle.to_tensor(20)
...
@@ -2816,7 +2817,7 @@ def gcd(x, y, name=None):
...
@@ -2816,7 +2817,7 @@ def gcd(x, y, name=None):
# Tensor(shape=[1], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# Tensor(shape=[1], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# [4])
# [4])
x3 = paddle.
to_tensor(np.arange(6)
)
x3 = paddle.
arange(6
)
paddle.gcd(x3, x2)
paddle.gcd(x3, x2)
# Tensor(shape=[6], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# Tensor(shape=[6], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# [20, 1 , 2 , 1 , 4 , 5])
# [20, 1 , 2 , 1 , 4 , 5])
...
@@ -2873,9 +2874,11 @@ def lcm(x, y, name=None):
...
@@ -2873,9 +2874,11 @@ def lcm(x, y, name=None):
Note:
Note:
lcm(0,0)=0, lcm(0, y)=0
lcm(0,0)=0, lcm(0, y)=0
If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
Args:
Args:
x
, y
(Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8.
x (Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8.
If x.shape != y.shape, they must be broadcastable to a common shape (which becomes the shape of the output).
y (Tensor): An N-D Tensor, the data type is int8,int16,int32,int64,uint8.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Returns:
...
@@ -2885,7 +2888,6 @@ def lcm(x, y, name=None):
...
@@ -2885,7 +2888,6 @@ def lcm(x, y, name=None):
.. code-block:: python
.. code-block:: python
import paddle
import paddle
import numpy as np
x1 = paddle.to_tensor(12)
x1 = paddle.to_tensor(12)
x2 = paddle.to_tensor(20)
x2 = paddle.to_tensor(20)
...
@@ -2893,7 +2895,7 @@ def lcm(x, y, name=None):
...
@@ -2893,7 +2895,7 @@ def lcm(x, y, name=None):
# Tensor(shape=[1], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# Tensor(shape=[1], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# [60])
# [60])
x3 = paddle.
to_tensor(np.arange(6)
)
x3 = paddle.
arange(6
)
paddle.lcm(x3, x2)
paddle.lcm(x3, x2)
# Tensor(shape=[6], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# Tensor(shape=[6], dtype=int64, place=CUDAPlace(0), stop_gradient=True,
# [0, 20, 20, 60, 20, 20])
# [0, 20, 20, 60, 20, 20])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录