Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
339cb191
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看板
未验证
提交
339cb191
编写于
10月 11, 2021
作者:
J
jakpiase
提交者:
GitHub
10月 11, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix for matmul_v2 6D x 2D (#36342)
上级
7b45a46e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
24 addition
and
5 deletion
+24
-5
paddle/fluid/operators/mkldnn/matmul_v2_mkldnn_op.cc
paddle/fluid/operators/mkldnn/matmul_v2_mkldnn_op.cc
+4
-4
python/paddle/fluid/tests/unittests/mkldnn/test_matmul_v2_mkldnn_op.py
.../fluid/tests/unittests/mkldnn/test_matmul_v2_mkldnn_op.py
+20
-1
未找到文件。
paddle/fluid/operators/mkldnn/matmul_v2_mkldnn_op.cc
浏览文件 @
339cb191
...
@@ -148,8 +148,8 @@ class MatMulV2MKLDNNKernel
...
@@ -148,8 +148,8 @@ class MatMulV2MKLDNNKernel
if
(
x_dims
.
size
()
==
1
)
{
if
(
x_dims
.
size
()
==
1
)
{
x_bd_dims
[
x_bd_dims
.
size
()
-
1
]
=
x_dims
[
0
];
x_bd_dims
[
x_bd_dims
.
size
()
-
1
]
=
x_dims
[
0
];
}
else
if
(
x_dims
.
size
()
==
2
)
{
}
else
if
(
x_dims
.
size
()
==
2
)
{
x_bd_dims
[
2
]
=
x_dims
[
1
];
x_bd_dims
[
x_bd_dims
.
size
()
-
1
]
=
x_dims
[
1
];
x_bd_dims
[
1
]
=
x_dims
[
0
];
x_bd_dims
[
x_bd_dims
.
size
()
-
2
]
=
x_dims
[
0
];
}
else
{
}
else
{
for
(
size_t
i
=
0
;
i
<
x_dims
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
x_dims
.
size
();
++
i
)
{
x_bd_dims
[
i
]
=
x_dims
[
i
];
x_bd_dims
[
i
]
=
x_dims
[
i
];
...
@@ -158,8 +158,8 @@ class MatMulV2MKLDNNKernel
...
@@ -158,8 +158,8 @@ class MatMulV2MKLDNNKernel
if
(
y_dims
.
size
()
==
1
)
{
if
(
y_dims
.
size
()
==
1
)
{
y_bd_dims
[
x_bd_dims
.
size
()
-
2
]
=
y_dims
[
0
];
y_bd_dims
[
x_bd_dims
.
size
()
-
2
]
=
y_dims
[
0
];
}
else
if
(
y_dims
.
size
()
==
2
)
{
}
else
if
(
y_dims
.
size
()
==
2
)
{
y_bd_dims
[
2
]
=
y_dims
[
1
];
y_bd_dims
[
y_bd_dims
.
size
()
-
1
]
=
y_dims
[
1
];
y_bd_dims
[
1
]
=
y_dims
[
0
];
y_bd_dims
[
y_bd_dims
.
size
()
-
2
]
=
y_dims
[
0
];
}
else
{
}
else
{
for
(
size_t
i
=
0
;
i
<
y_dims
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
y_dims
.
size
();
++
i
)
{
y_bd_dims
[
i
]
=
y_dims
[
i
];
y_bd_dims
[
i
]
=
y_dims
[
i
];
...
...
python/paddle/fluid/tests/unittests/mkldnn/test_matmul_v2_mkldnn_op.py
浏览文件 @
339cb191
...
@@ -235,6 +235,22 @@ class TestMatMulV2MatrixXMatrix5DTranposeYOneDNNOp(
...
@@ -235,6 +235,22 @@ class TestMatMulV2MatrixXMatrix5DTranposeYOneDNNOp(
self
.
trans_y
=
True
self
.
trans_y
=
True
class
TestMatMulV2MatrixXMatrix6Dx2DOneDNNOp
(
TestMatMulV2VectorXVectorOneDNNOp
):
def
config
(
self
):
self
.
x_shape
=
(
1
,
1
,
2
,
1
,
8
,
9
)
self
.
y_shape
=
(
9
,
12
)
self
.
trans_x
=
False
self
.
trans_y
=
False
class
TestMatMulV2MatrixXMatrix2Dx5DOneDNNOp
(
TestMatMulV2VectorXVectorOneDNNOp
):
def
config
(
self
):
self
.
x_shape
=
(
20
,
5
)
self
.
y_shape
=
(
1
,
2
,
1
,
5
,
11
)
self
.
trans_x
=
False
self
.
trans_y
=
False
# BF16 TESTS
# BF16 TESTS
def
create_bf16_test_class
(
parent
):
def
create_bf16_test_class
(
parent
):
@
OpTestTool
.
skip_if_not_cpu_bf16
()
@
OpTestTool
.
skip_if_not_cpu_bf16
()
...
@@ -274,7 +290,8 @@ def create_bf16_test_class(parent):
...
@@ -274,7 +290,8 @@ def create_bf16_test_class(parent):
2
:
[
1
,
0
],
2
:
[
1
,
0
],
3
:
[
0
,
2
,
1
],
3
:
[
0
,
2
,
1
],
4
:
[
0
,
1
,
3
,
2
],
4
:
[
0
,
1
,
3
,
2
],
5
:
[
0
,
1
,
2
,
4
,
3
]
5
:
[
0
,
1
,
2
,
4
,
3
],
6
:
[
0
,
1
,
2
,
3
,
5
,
4
]
}
}
# expand vector so it will be a valid matrix for multiplication
# expand vector so it will be a valid matrix for multiplication
...
@@ -370,6 +387,8 @@ create_bf16_test_class(TestMatMulV2Matrix3DXVectorOneDNNOp)
...
@@ -370,6 +387,8 @@ create_bf16_test_class(TestMatMulV2Matrix3DXVectorOneDNNOp)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrixTransposeXTransposeYOneDNNOp
)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrixTransposeXTransposeYOneDNNOp
)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrixTransposeY2OneDNNOp
)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrixTransposeY2OneDNNOp
)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrix5DTranposeYOneDNNOp
)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrix5DTranposeYOneDNNOp
)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrix6Dx2DOneDNNOp
)
create_bf16_test_class
(
TestMatMulV2MatrixXMatrix2Dx5DOneDNNOp
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
paddle
.
enable_static
()
paddle
.
enable_static
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录