Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
259858b4
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
259858b4
编写于
1月 18, 2018
作者:
C
chengduoZH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify doc
上级
578d60bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
2 deletion
+9
-2
paddle/operators/math/matmul.h
paddle/operators/math/matmul.h
+1
-0
paddle/operators/matmul_op.cc
paddle/operators/matmul_op.cc
+7
-1
paddle/operators/matmul_op.h
paddle/operators/matmul_op.h
+1
-1
未找到文件。
paddle/operators/math/matmul.h
浏览文件 @
259858b4
...
...
@@ -49,6 +49,7 @@ class MatMulFunctor {
"The dimensions of X and Y must be the same, and both of "
"them should be %d-dimensional."
,
dim_b
.
size
());
// The previous Rank-2 dimensions are accumulated on the batch_count.
for
(
int
j
=
0
;
j
<
dim_a
.
size
()
-
2
;
++
j
)
{
PADDLE_ENFORCE
(
dim_b
[
j
]
==
dim_a
[
j
],
"The dimensions of X[%d] and Y[%d] must be the same."
,
j
,
...
...
paddle/operators/matmul_op.cc
浏览文件 @
259858b4
...
...
@@ -49,6 +49,8 @@ class MatMulOp : public framework::OperatorWithKernel {
"The dimensions of X and Y must be the same, and both of "
"them should be %d-dimensional."
,
dim_x
.
size
());
// The previous Rank-2 dimensions are accumulated on the batch_count.
for
(
int
j
=
0
;
j
<
dim_x
.
size
()
-
2
;
++
j
)
{
PADDLE_ENFORCE
(
dim_y
[
j
]
==
dim_x
[
j
],
"The dimensions of X[%d] and Y[%d] must be the same."
,
j
,
...
...
@@ -185,10 +187,14 @@ Examples without transpose:
- X: [B, M, K], Y: [K] => Out: [B, M]
- X: [M, K], Y: [B, K, N] => Out: [B, M, N]
- X: [B, M, K], Y: [B, K, N] => Out: [B, M, N]
- X: [B, ..., M, K], Y: [B, ..., K, N] => Out: [B, ..., M, N]
The behavior is designed to be similar to the `numpy.matmul` function.
The differences are:
- Currently only rank 1 to rank 3 input tensors are supported.
- When the rank of the input is greater than 3, the rank of X and
Y must be equal, and the former rank-2 dimensions are equal.
- When the rank of the input data is less than or equal to 3, it
is similar to the `numpy.matmul` function.
- We add `transpose_X` and `transpose_Y` flags.
Both the input `X` and `Y` can carry the LoD (Level of Details) information,
...
...
paddle/operators/matmul_op.h
浏览文件 @
259858b4
...
...
@@ -138,7 +138,7 @@ class MatMulGradKernel : public framework::OpKernel<T> {
}
int
batch_count
=
0
;
//
//
The previous Rank-2 dimensions are accumulated on the batch_count.
if
(
x_dims
.
size
()
>
3
)
{
batch_count
=
accumulate
(
x_dims
.
begin
(),
x_dims
.
end
()
-
2
,
1
,
std
::
multiplies
<
int
>
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录