Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6febe5fe
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看板
未验证
提交
6febe5fe
编写于
7月 14, 2021
作者:
Y
Yuang Liu
提交者:
GitHub
7月 14, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename the fuse op, test=allcase (#34120)
上级
14fd6cfb
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
13 addition
and
13 deletion
+13
-13
paddle/fluid/operators/fused_softmax_mask_upper_triangle_op.cc
...e/fluid/operators/fused_softmax_mask_upper_triangle_op.cc
+5
-5
paddle/fluid/operators/fused_softmax_mask_upper_triangle_op.cu
...e/fluid/operators/fused_softmax_mask_upper_triangle_op.cu
+3
-3
paddle/fluid/operators/fused_softmax_mask_upper_triangle_op.h
...le/fluid/operators/fused_softmax_mask_upper_triangle_op.h
+0
-0
python/paddle/fluid/tests/unittests/test_softmax_mask_fuse_upper_triangle_op.py
...sts/unittests/test_softmax_mask_fuse_upper_triangle_op.py
+2
-2
python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py
...le/incubate/operators/softmax_mask_fuse_upper_triangle.py
+3
-3
未找到文件。
paddle/fluid/operators/
softmax_mask_fuse
_upper_triangle_op.cc
→
paddle/fluid/operators/
fused_softmax_mask
_upper_triangle_op.cc
浏览文件 @
6febe5fe
...
@@ -10,7 +10,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
...
@@ -10,7 +10,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#include "paddle/fluid/operators/
softmax_mask_fuse
_upper_triangle_op.h"
#include "paddle/fluid/operators/
fused_softmax_mask
_upper_triangle_op.h"
#include "paddle/fluid/framework/generator.h"
#include "paddle/fluid/framework/generator.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/op_registry.h"
namespace
paddle
{
namespace
paddle
{
...
@@ -82,7 +82,7 @@ class SoftmaxMaskFuseUpperTriangleGradOpMaker
...
@@ -82,7 +82,7 @@ class SoftmaxMaskFuseUpperTriangleGradOpMaker
protected:
protected:
void
Apply
(
GradOpPtr
<
T
>
op
)
const
override
{
void
Apply
(
GradOpPtr
<
T
>
op
)
const
override
{
op
->
SetType
(
"
softmax_mask_fuse
_upper_triangle_grad"
);
op
->
SetType
(
"
fused_softmax_mask
_upper_triangle_grad"
);
op
->
SetInput
(
"Softmax"
,
this
->
Output
(
"Out"
));
op
->
SetInput
(
"Softmax"
,
this
->
Output
(
"Out"
));
op
->
SetInput
(
framework
::
GradVarName
(
"Out"
),
this
->
OutputGrad
(
"Out"
));
op
->
SetInput
(
framework
::
GradVarName
(
"Out"
),
this
->
OutputGrad
(
"Out"
));
op
->
SetOutput
(
framework
::
GradVarName
(
"X"
),
this
->
InputGrad
(
"X"
));
op
->
SetOutput
(
framework
::
GradVarName
(
"X"
),
this
->
InputGrad
(
"X"
));
...
@@ -94,13 +94,13 @@ class SoftmaxMaskFuseUpperTriangleGradOpMaker
...
@@ -94,13 +94,13 @@ class SoftmaxMaskFuseUpperTriangleGradOpMaker
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OPERATOR
(
REGISTER_OPERATOR
(
softmax_mask_fuse
_upper_triangle
,
ops
::
SoftmaxMaskFuseUpperTriangleOp
,
fused_softmax_mask
_upper_triangle
,
ops
::
SoftmaxMaskFuseUpperTriangleOp
,
ops
::
SoftmaxMaskFuseUpperTriangleOpMaker
,
ops
::
SoftmaxMaskFuseUpperTriangleOpMaker
,
ops
::
SoftmaxMaskFuseUpperTriangleGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
SoftmaxMaskFuseUpperTriangleGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
ops
::
SoftmaxMaskFuseUpperTriangleGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
ops
::
SoftmaxMaskFuseUpperTriangleGradOpMaker
<
paddle
::
imperative
::
OpBase
>
);
REGISTER_OPERATOR
(
softmax_mask_fuse
_upper_triangle_grad
,
REGISTER_OPERATOR
(
fused_softmax_mask
_upper_triangle_grad
,
ops
::
SoftmaxMaskFuseUpperTriangleOpGrad
);
ops
::
SoftmaxMaskFuseUpperTriangleOpGrad
);
REGISTER_OP_CPU_KERNEL
(
softmax_mask_fuse
_upper_triangle
,
REGISTER_OP_CPU_KERNEL
(
fused_softmax_mask
_upper_triangle
,
ops
::
SoftmaxMaskFuseUpperTriangleCPUKernel
<
ops
::
SoftmaxMaskFuseUpperTriangleCPUKernel
<
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
paddle
::
platform
::
CPUDeviceContext
,
float
>
,
ops
::
SoftmaxMaskFuseUpperTriangleCPUKernel
<
ops
::
SoftmaxMaskFuseUpperTriangleCPUKernel
<
...
...
paddle/fluid/operators/
softmax_mask_fuse
_upper_triangle_op.cu
→
paddle/fluid/operators/
fused_softmax_mask
_upper_triangle_op.cu
浏览文件 @
6febe5fe
...
@@ -31,7 +31,7 @@ limitations under the License. */
...
@@ -31,7 +31,7 @@ limitations under the License. */
#include "paddle/fluid/framework/generator.h"
#include "paddle/fluid/framework/generator.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/memory/memcpy.h"
#include "paddle/fluid/memory/memcpy.h"
#include "paddle/fluid/operators/
softmax_mask_fuse
_upper_triangle_op.h"
#include "paddle/fluid/operators/
fused_softmax_mask
_upper_triangle_op.h"
#include "paddle/fluid/platform/float16.h"
#include "paddle/fluid/platform/float16.h"
namespace
paddle
{
namespace
paddle
{
...
@@ -534,12 +534,12 @@ class SoftmaxMaskFuseUpperTriangleGradKernel : public framework::OpKernel<T> {
...
@@ -534,12 +534,12 @@ class SoftmaxMaskFuseUpperTriangleGradKernel : public framework::OpKernel<T> {
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
namespace
plat
=
paddle
::
platform
;
namespace
plat
=
paddle
::
platform
;
REGISTER_OP_CUDA_KERNEL
(
REGISTER_OP_CUDA_KERNEL
(
softmax_mask_fuse
_upper_triangle
,
fused_softmax_mask
_upper_triangle
,
ops
::
SoftmaxMaskFuseUpperTriangleKernel
<
plat
::
CUDADeviceContext
,
ops
::
SoftmaxMaskFuseUpperTriangleKernel
<
plat
::
CUDADeviceContext
,
plat
::
float16
>
,
plat
::
float16
>
,
ops
::
SoftmaxMaskFuseUpperTriangleKernel
<
plat
::
CUDADeviceContext
,
float
>
);
ops
::
SoftmaxMaskFuseUpperTriangleKernel
<
plat
::
CUDADeviceContext
,
float
>
);
REGISTER_OP_CUDA_KERNEL
(
REGISTER_OP_CUDA_KERNEL
(
softmax_mask_fuse
_upper_triangle_grad
,
fused_softmax_mask
_upper_triangle_grad
,
ops
::
SoftmaxMaskFuseUpperTriangleGradKernel
<
plat
::
CUDADeviceContext
,
ops
::
SoftmaxMaskFuseUpperTriangleGradKernel
<
plat
::
CUDADeviceContext
,
plat
::
float16
>
,
plat
::
float16
>
,
ops
::
SoftmaxMaskFuseUpperTriangleGradKernel
<
plat
::
CUDADeviceContext
,
ops
::
SoftmaxMaskFuseUpperTriangleGradKernel
<
plat
::
CUDADeviceContext
,
...
...
paddle/fluid/operators/
softmax_mask_fuse
_upper_triangle_op.h
→
paddle/fluid/operators/
fused_softmax_mask
_upper_triangle_op.h
浏览文件 @
6febe5fe
文件已移动
python/paddle/fluid/tests/unittests/test_softmax_mask_fuse_upper_triangle_op.py
浏览文件 @
6febe5fe
...
@@ -42,7 +42,7 @@ def _get_softmax_upper(x, fp16=True):
...
@@ -42,7 +42,7 @@ def _get_softmax_upper(x, fp16=True):
"core is not compiled with CUDA"
)
"core is not compiled with CUDA"
)
class
TestSoftmaxMaskFuseOp
(
OpTest
):
class
TestSoftmaxMaskFuseOp
(
OpTest
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"
softmax_mask_fuse
_upper_triangle"
self
.
op_type
=
"
fused_softmax_mask
_upper_triangle"
x
=
np
.
random
.
random
((
1
,
1
,
32
,
32
)).
astype
(
"float16"
)
x
=
np
.
random
.
random
((
1
,
1
,
32
,
32
)).
astype
(
"float16"
)
self
.
inputs
=
{
'X'
:
x
}
self
.
inputs
=
{
'X'
:
x
}
rst
=
_get_softmax_upper
(
x
)
rst
=
_get_softmax_upper
(
x
)
...
@@ -59,7 +59,7 @@ class TestSoftmaxMaskFuseOp(OpTest):
...
@@ -59,7 +59,7 @@ class TestSoftmaxMaskFuseOp(OpTest):
"core is not compiled with CUDA"
)
"core is not compiled with CUDA"
)
class
TestSoftmaxMaskFuseOp1
(
OpTest
):
class
TestSoftmaxMaskFuseOp1
(
OpTest
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"
softmax_mask_fuse
_upper_triangle"
self
.
op_type
=
"
fused_softmax_mask
_upper_triangle"
x
=
np
.
random
.
random
((
1
,
1
,
32
,
32
))
x
=
np
.
random
.
random
((
1
,
1
,
32
,
32
))
self
.
inputs
=
{
'X'
:
x
}
self
.
inputs
=
{
'X'
:
x
}
rst
=
_get_softmax_upper
(
x
)
rst
=
_get_softmax_upper
(
x
)
...
...
python/paddle/incubate/operators/softmax_mask_fuse_upper_triangle.py
浏览文件 @
6febe5fe
...
@@ -28,15 +28,15 @@ def softmax_mask_fuse_upper_triangle(x):
...
@@ -28,15 +28,15 @@ def softmax_mask_fuse_upper_triangle(x):
:return: the result of softmax mask fuse (upper triangle)
:return: the result of softmax mask fuse (upper triangle)
"""
"""
if
in_dygraph_mode
():
if
in_dygraph_mode
():
out
=
core
.
ops
.
softmax_mask_fuse
_upper_triangle
(
x
)
out
=
core
.
ops
.
fused_softmax_mask
_upper_triangle
(
x
)
return
out
return
out
helper
=
LayerHelper
(
'
softmax_mask_fuse
_upper_triangle'
,
**
locals
())
helper
=
LayerHelper
(
'
fused_softmax_mask
_upper_triangle'
,
**
locals
())
out
=
helper
.
create_variable_for_type_inference
(
dtype
=
x
.
dtype
)
out
=
helper
.
create_variable_for_type_inference
(
dtype
=
x
.
dtype
)
helper
.
append_op
(
helper
.
append_op
(
type
=
'
softmax_mask_fuse
_upper_triangle'
,
type
=
'
fused_softmax_mask
_upper_triangle'
,
inputs
=
{
'X'
:
[
x
]},
inputs
=
{
'X'
:
[
x
]},
outputs
=
{
'Out'
:
[
out
]})
outputs
=
{
'Out'
:
[
out
]})
return
out
return
out
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录