Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f6cea357
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看板
提交
f6cea357
编写于
1月 22, 2018
作者:
Y
ying
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rendering error of transpose operator.
上级
eaa8d680
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
23 addition
and
28 deletion
+23
-28
paddle/operators/transpose_op.cc
paddle/operators/transpose_op.cc
+23
-28
未找到文件。
paddle/operators/transpose_op.cc
浏览文件 @
f6cea357
...
@@ -59,44 +59,39 @@ class TransposeOpMaker : public framework::OpProtoAndCheckerMaker {
...
@@ -59,44 +59,39 @@ class TransposeOpMaker : public framework::OpProtoAndCheckerMaker {
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
AddInput
(
AddInput
(
"X"
,
"X"
,
"(Tensor)
The input tensor, tensors with rank at most 6 are supported
"
);
"(Tensor)
The input tensor, tensors with rank up to 6 are supported.
"
);
AddOutput
(
"Out"
,
"(Tensor)The output tensor"
);
AddOutput
(
"Out"
,
"(Tensor)The output tensor
.
"
);
AddAttr
<
std
::
vector
<
int
>>
(
AddAttr
<
std
::
vector
<
int
>>
(
"axis"
,
"axis"
,
"(vector<int>)A list of values, and the size of the list should be "
"(vector<int>)
A list of values, and the size of the list should be "
"the same with the input tensor rank
, the tensor will
"
"the same with the input tensor rank
. This operator permutes the input
"
"
permute the axes according the the values given
"
);
"
tensor's axes according to the values given.
"
);
AddComment
(
R"DOC(
AddComment
(
R"DOC(
Transpose Operator.
Transpose Operator.
The input tensor will be permuted according to the ax
is valu
es given.
The input tensor will be permuted according to the axes given.
The
op functions is similar to how numpy.transpose works in python
.
The
behavior of this operator is similar to how `numpy.transpose` works
.
For example:
- suppose the input `X` is a 2-D tensor:
$$
X = \begin{pmatrix}
0 &1 &2 \\
3 &4 &5
\end{pmatrix}$$
.. code-block:: text
the given `axes` is: $[1, 0]$, and $Y$ = transpose($X$, axis)
input = numpy.arange(6).reshape((2,3))
then the output $Y$ is:
the input is:
$$
Y = \begin{pmatrix}
0 &3 \\
1 &4 \\
2 &5
\end{pmatrix}$$
array([[0, 1, 2],
- Given a input tensor with shape $(N, C, H, W)$ and the `axes` is
[3, 4, 5]])
$[0, 2, 3, 1]$, then shape of the output tensor will be: $(N, H, W, C)$.
given axis is:
[1, 0]
output = input.transpose(axis)
then the output is:
array([[0, 3],
[1, 4],
[2, 5]])
So, given a input tensor of shape(N, C, H, W) and the axis is {0, 2, 3, 1},
the output tensor shape will be (N, H, W, C)
)DOC"
);
)DOC"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录