Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
5b8bb344
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5b8bb344
编写于
3月 29, 2018
作者:
G
guosheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refine reshape_op by following comments.
上级
09743b61
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
8 deletion
+9
-8
paddle/fluid/operators/reshape_op.cc
paddle/fluid/operators/reshape_op.cc
+6
-4
paddle/fluid/operators/reshape_op.h
paddle/fluid/operators/reshape_op.h
+0
-1
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+3
-3
未找到文件。
paddle/fluid/operators/reshape_op.cc
浏览文件 @
5b8bb344
...
...
@@ -49,14 +49,14 @@ Examples:
specified by Attr(shape) is [6, 8], the reshape operator will transform Input(X)
into a 2-D tensor with shape [6, 8] and leaving Input(X)'s data unchanged.
1
. Given a 3-D tensor Input(X) with a shape [2, 4, 6], and the target shape
2
. Given a 3-D tensor Input(X) with a shape [2, 4, 6], and the target shape
specified by Attr(shape) is [2, 3, -1, 2], the reshape operator will transform
Input(X) into a 4-D tensor with shape [2, 3, 4, 2] and leaving Input(X)'s data
unchanged. In this case, one and only dimension of Attr(shape) can be set to -1,
the value of this dimension is inferred from the total element number of
Input(X) and remaining dimensions.
1
. Given a 3-D tensor Input(X) with a shape [2, 4, 6], and the target shape
3
. Given a 3-D tensor Input(X) with a shape [2, 4, 6], and the target shape
specified by Attr(shape) is [-1, 0, 3, 2], the reshape operator will transform
Input(X) into a 4-D tensor with shape [2, 4, 3, 2] and leaving Input(X)'s data
unchanged. In this case, besides -1, 0 means the actual dimension value is going
...
...
@@ -67,11 +67,13 @@ Note:
1. One and only one dimension in Attr(shape) can be set -1. In this case,
the actual dimension value will be infered from the total element number of
Input(X) and remaining dimensions.
1. More than one dimensions in Attr(shape) can be set to 0, which means the real
2. More than one dimensions in Attr(shape) can be set to 0, which means the real
dimension value will be copied from Input(X) at runtime. Note that the index of
0 can not exceed Rank(X). For example, Input(X) is a 3-D tensor with shape
[2, 3, 4], Attr(shape) = [2, 3, 2, 0] is an invalid input.
1. Input(Shape) has a higher priority than Attr(shape) if it is provided, while
3. Input(Shape) has a higher priority than Attr(shape) if it is provided, while
Attr(shape) still should be set correctly to gurantee shape inference in
compile-time.
...
...
paddle/fluid/operators/reshape_op.h
浏览文件 @
5b8bb344
...
...
@@ -66,7 +66,6 @@ class ReshapeOp : public framework::OperatorWithKernel {
int64_t
capacity
=
1
;
int
unk_dim_idx
=
-
1
;
for
(
size_t
i
=
0
;
i
<
shape
.
size
();
++
i
)
{
// std::cout<< shape[i] << "haha";
if
(
shape
[
i
]
==
unk_dim_val
)
{
PADDLE_ENFORCE
(
unk_dim_idx
==
-
1
,
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
5b8bb344
...
...
@@ -3337,7 +3337,7 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=True, name=None):
number of x and remaining dimensions. Thus one and only one dimension can
be set -1.
1
. 0 means the actual dimension value is going to be copied from the
2
. 0 means the actual dimension value is going to be copied from the
corresponding dimension of x. The indice of 0s in shape can not exceed
Rank(X).
...
...
@@ -3347,14 +3347,14 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=True, name=None):
is [6, 8], the reshape operator will transform x into a 2-D tensor with
shape [6, 8] and leaving x's data unchanged.
1
. Given a 3-D tensor x with a shape [2, 4, 6], and the target shape
2
. Given a 3-D tensor x with a shape [2, 4, 6], and the target shape
specified is [2, 3, -1, 2], the reshape operator will transform x into a
4-D tensor with shape [2, 3, 4, 2] and leaving x's data unchanged. In this
case, one dimension of the target shape is set to -1, the value of this
dimension is inferred from the total element number of x and remaining
dimensions.
1
. Given a 3-D tensor x with a shape [2, 4, 6], and the target shape
3
. Given a 3-D tensor x with a shape [2, 4, 6], and the target shape
is [-1, 0, 3, 2], the reshape operator will transform x into a 4-D tensor
with shape [2, 4, 3, 2] and leaving x's data unchanged. In this case,
besides -1, 0 means the actual dimension value is going to be copied from
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录