Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
a069e1ca
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
a069e1ca
编写于
11月 30, 2020
作者:
Y
yaoxuefeng
提交者:
GitHub
11月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix docs (#29097)
上级
786e69e9
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
9 addition
and
40 deletion
+9
-40
python/paddle/fluid/dygraph/nn.py
python/paddle/fluid/dygraph/nn.py
+0
-5
python/paddle/tensor/creation.py
python/paddle/tensor/creation.py
+4
-15
python/paddle/tensor/linalg.py
python/paddle/tensor/linalg.py
+0
-3
python/paddle/tensor/manipulation.py
python/paddle/tensor/manipulation.py
+5
-14
python/paddle/tensor/math.py
python/paddle/tensor/math.py
+0
-3
未找到文件。
python/paddle/fluid/dygraph/nn.py
浏览文件 @
a069e1ca
...
...
@@ -3197,14 +3197,10 @@ class TreeConv(layers.Layer):
class
Flatten
(
layers
.
Layer
):
"""
:alias_main: paddle.nn.Flatten
:alias: paddle.nn.Flatten,paddle.nn.layer.Flatten,paddle.nn.layer.common.Flatten
This interface is used to construct a callable object of the ``FLatten`` class.
For more details, refer to code examples.
It implements flatten a contiguous range of dims into a tensor.
Equation:
Parameters:
start_axis(int): first dim to flatten (default = 1)
stop_axis(int): last dim to flatten (default = -1).
...
...
@@ -3218,7 +3214,6 @@ class Flatten(layers.Layer):
import paddle
import numpy as np
paddle.disable_static()
inp_np = np.ones([5, 2, 3, 4]).astype('float32')
inp_np = paddle.to_tensor(inp_np)
...
...
python/paddle/tensor/creation.py
浏览文件 @
a069e1ca
...
...
@@ -610,16 +610,13 @@ def _tril_triu_op(helper):
def
tril
(
x
,
diagonal
=
0
,
name
=
None
):
r
"""
:alias_main: paddle.tril
:alias: paddle.tril,paddle.tensor.tril,paddle.tensor.creation.tril
This op returns the lower triangular part of a matrix (2-D tensor) or batch
of matrices :attr:`x`, the other elements of the result tensor are set
to 0. The lower triangular part of the matrix is defined as the elements
on and below the diagonal.
Args:
x (
Variable): The input variable
x which is a Tensor.
x (
Tensor): The input
x which is a Tensor.
Support data types: ``float64``, ``float32``, ``int32``, ``int64``.
diagonal (int, optional): The diagonal to consider, default value is 0.
If :attr:`diagonal` = 0, all elements on and below the main diagonal are
...
...
@@ -632,7 +629,7 @@ def tril(x, diagonal=0, name=None):
user to set this property. For more information, please refer to :ref:`api_guide_Name`.
Returns:
Variable: Tensor, r
esults of lower triangular operation by the specified diagonal of input tensor x,
Tensor: R
esults of lower triangular operation by the specified diagonal of input tensor x,
it's data type is the same as x's Tensor.
Raises:
...
...
@@ -650,7 +647,6 @@ def tril(x, diagonal=0, name=None):
# [ 5, 6, 7, 8],
# [ 9, 10, 11, 12]])
paddle.disable_static()
x = paddle.to_tensor(data)
...
...
@@ -681,16 +677,13 @@ def tril(x, diagonal=0, name=None):
def
triu
(
x
,
diagonal
=
0
,
name
=
None
):
r
"""
:alias_main: paddle.triu
:alias: paddle.triu,paddle.tensor.triu,paddle.tensor.creation.triu
This op returns the upper triangular part of a matrix (2-D tensor) or batch of matrices
:attr:`x`, the other elements of the result tensor are set to 0.
The upper triangular part of the matrix is defined as the elements on and
above the diagonal.
Args:
x (
Variable): The input variable
x which is a Tensor.
x (
Tensor): The input
x which is a Tensor.
Support data types: ``float64``, ``float32``, ``int32``, ``int64``.
diagonal (int, optional): The diagonal to consider, default value is 0.
If :attr:`diagonal` = 0, all elements on and above the main diagonal are
...
...
@@ -703,7 +696,7 @@ def triu(x, diagonal=0, name=None):
user to set this property. For more information, please refer to :ref:`api_guide_Name`.
Returns:
Variable: Tensor, r
esults of upper triangular operation by the specified diagonal of input tensor x,
Tensor: R
esults of upper triangular operation by the specified diagonal of input tensor x,
it's data type is the same as x's Tensor.
Raises:
...
...
@@ -721,7 +714,6 @@ def triu(x, diagonal=0, name=None):
# [ 5, 6, 7, 8],
# [ 9, 10, 11, 12]])
paddle.disable_static()
# example 1, default diagonal
x = paddle.to_tensor(data)
...
...
@@ -752,9 +744,6 @@ def triu(x, diagonal=0, name=None):
def
meshgrid
(
*
args
,
**
kwargs
):
"""
:alias_main: paddle.meshgrid
:alias: paddle.meshgrid,paddle.tensor.meshgrid,paddle.tensor.creation.meshgrid
This op takes a list of N tensors as input *args, each of which is 1-dimensional
vector, and creates N-dimensional grids.
...
...
python/paddle/tensor/linalg.py
浏览文件 @
a069e1ca
...
...
@@ -792,9 +792,6 @@ def cholesky(x, upper=False, name=None):
def
bmm
(
x
,
y
,
name
=
None
):
"""
:alias_main: paddle.bmm
:alias: paddle.bmm,paddle.tensor.bmm,paddle.tensor.linalg.bmm
Applies batched matrix multiplication to two tensors.
Both of the two input tensors must be three-dementional and share the same batch size.
...
...
python/paddle/tensor/manipulation.py
浏览文件 @
a069e1ca
...
...
@@ -116,21 +116,17 @@ def concat(x, axis=0, name=None):
def
flip
(
x
,
axis
,
name
=
None
):
"""
:alias_main: paddle.flip
:alias: paddle.flip,paddle.tensor.flip,paddle.tensor.manipulation.flip
Reverse the order of a n-D tensor along given axis in axis.
Args:
x (
Variable
): A Tensor(or LoDTensor) with shape :math:`[N_1, N_2,..., N_k]` . The data type of the input Tensor x
x (
Tensor
): A Tensor(or LoDTensor) with shape :math:`[N_1, N_2,..., N_k]` . The data type of the input Tensor x
should be float32, float64, int32, int64, bool.
axis (list): The axis(axes) to flip on. Negative indices for indexing from the end are accepted.
name (str, optional): The default value is None. Normally there is no need for user to set this property.
For more information, please refer to :ref:`api_guide_Name` .
Returns:
Variable
: Tensor or LoDTensor calculated by flip layer. The data type is same with input x.
Tensor
: Tensor or LoDTensor calculated by flip layer. The data type is same with input x.
Examples:
.. code-block:: python
...
...
@@ -138,8 +134,6 @@ def flip(x, axis, name=None):
import paddle
import numpy as np
paddle.disable_static()
image_shape=(3, 2, 2)
x = np.arange(image_shape[0] * image_shape[1] * image_shape[2]).reshape(image_shape)
x = x.astype('float32')
...
...
@@ -275,16 +269,13 @@ def flatten(x, start_axis=0, stop_axis=-1, name=None):
def
roll
(
x
,
shifts
,
axis
=
None
,
name
=
None
):
"""
:alias_main: paddle.roll
:alias: paddle.roll,paddle.tensor.roll,paddle.tensor.manipulation.roll
Roll the `x` tensor along the given axis(axes). With specific 'shifts', Elements that
roll beyond the last position are re-introduced at the first according to 'shifts'.
If a axis is not specified,
the tensor will be flattened before rolling and then restored to the original shape.
Args:
x (Tensor): The x tensor
variable
as input.
x (Tensor): The x tensor as input.
shifts (int|list|tuple): The number of places by which the elements
of the `x` tensor are shifted.
axis (int|list|tuple|None): axis(axes) along which to roll.
...
...
@@ -300,12 +291,12 @@ def roll(x, shifts, axis=None, name=None):
[4.0, 5.0, 6.0],
[7.0, 8.0, 9.0]])
out_z1 = paddle.roll(x, shifts=1)
print(out_z1
.numpy()
)
print(out_z1)
#[[9. 1. 2.]
# [3. 4. 5.]
# [6. 7. 8.]]
out_z2 = paddle.roll(x, shifts=1, axis=0)
print(out_z2
.numpy()
)
print(out_z2)
#[[7. 8. 9.]
# [1. 2. 3.]
# [4. 5. 6.]]
...
...
python/paddle/tensor/math.py
浏览文件 @
a069e1ca
...
...
@@ -953,9 +953,6 @@ def mm(input, mat2, name=None):
def
addmm
(
input
,
x
,
y
,
beta
=
1.0
,
alpha
=
1.0
,
name
=
None
):
"""
:alias_main: paddle.addmm
:alias: paddle.addmm,paddle.tensor.addmm,paddle.tensor.math.addmm
**addmm**
This operator is used to perform matrix multiplication for input $x$ and $y$.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录