Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
76e0926c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
76e0926c
编写于
8月 09, 2022
作者:
C
Charles-hit
提交者:
GitHub
8月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move api(erfinv) from legacy_api.yaml to api.yaml (#44987)
* move api(erfinv) from legacy_api.yaml to api.yaml * change inplace_map key
上级
a46d7fe6
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
28 addition
and
135 deletion
+28
-135
paddle/fluid/operators/erfinv_op.cc
paddle/fluid/operators/erfinv_op.cc
+0
-89
paddle/phi/api/yaml/api.yaml
paddle/phi/api/yaml/api.yaml
+10
-0
paddle/phi/api/yaml/api_compat.yaml
paddle/phi/api/yaml/api_compat.yaml
+6
-0
paddle/phi/api/yaml/backward.yaml
paddle/phi/api/yaml/backward.yaml
+10
-0
paddle/phi/api/yaml/generator/generate_op.py
paddle/phi/api/yaml/generator/generate_op.py
+1
-0
paddle/phi/api/yaml/generator/tests.py
paddle/phi/api/yaml/generator/tests.py
+1
-1
paddle/phi/api/yaml/legacy_api.yaml
paddle/phi/api/yaml/legacy_api.yaml
+0
-10
paddle/phi/api/yaml/legacy_backward.yaml
paddle/phi/api/yaml/legacy_backward.yaml
+0
-10
paddle/phi/ops/compat/erfinv_sig.cc
paddle/phi/ops/compat/erfinv_sig.cc
+0
-25
未找到文件。
paddle/fluid/operators/erfinv_op.cc
已删除
100644 → 0
浏览文件 @
a46d7fe6
// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/fluid/framework/infershape_utils.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/phi/core/infermeta_utils.h"
#include "paddle/phi/infermeta/unary.h"
namespace
paddle
{
namespace
operators
{
class
ErfinvOp
:
public
framework
::
OperatorWithKernel
{
public:
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
};
class
ErfinvOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
public:
void
Make
()
override
{
AddInput
(
"X"
,
"(Tensor), The input tensor of erfinv op."
);
AddOutput
(
"Out"
,
"(Tensor), The output tensor of erfinv op."
);
AddComment
(
R"DOC(
Erfinv Operator.
This operator is used to compute inverse error function of input $X$.
The equation is:
$$erfinv(x) = {ndtri({x \over 2} + 0.5)} \over {\sqrt{2}}$$
The input `X` can carry the LoD (Level of Details) information,
or not. And the output shares the LoD information with input `X`.
)DOC"
);
}
};
class
ErfinvGradOp
:
public
framework
::
OperatorWithKernel
{
public:
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
ctx
->
SetOutputDim
(
framework
::
GradVarName
(
"X"
),
ctx
->
GetInputDim
(
"Out"
));
}
};
template
<
typename
T
>
class
ErfinvGradMaker
:
public
framework
::
SingleGradOpMaker
<
T
>
{
public:
using
framework
::
SingleGradOpMaker
<
T
>::
SingleGradOpMaker
;
void
Apply
(
GradOpPtr
<
T
>
op
)
const
override
{
op
->
SetType
(
"erfinv_grad"
);
op
->
SetInput
(
"Out"
,
this
->
Output
(
"Out"
));
op
->
SetInput
(
framework
::
GradVarName
(
"Out"
),
this
->
OutputGrad
(
"Out"
));
op
->
SetOutput
(
framework
::
GradVarName
(
"X"
),
this
->
InputGrad
(
"X"
));
op
->
SetAttrMap
(
this
->
Attrs
());
}
};
DECLARE_INPLACE_OP_INFERER
(
ErfinvInplaceInferer
,
{
"X"
,
"Out"
});
}
// namespace operators
}
// namespace paddle
DECLARE_INFER_SHAPE_FUNCTOR
(
erfinv
,
ErfinvInferShapeFunctor
,
PD_INFER_META
(
phi
::
UnchangedInferMeta
));
REGISTER_OPERATOR
(
erfinv
,
paddle
::
operators
::
ErfinvOp
,
paddle
::
operators
::
ErfinvOpMaker
,
paddle
::
operators
::
ErfinvGradMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
operators
::
ErfinvGradMaker
<
paddle
::
imperative
::
OpBase
>
,
paddle
::
operators
::
ErfinvInplaceInferer
,
ErfinvInferShapeFunctor
);
REGISTER_OPERATOR
(
erfinv_grad
,
paddle
::
operators
::
ErfinvGradOp
);
paddle/phi/api/yaml/api.yaml
浏览文件 @
76e0926c
...
@@ -98,6 +98,16 @@
...
@@ -98,6 +98,16 @@
func
:
erf
func
:
erf
backward
:
erf_grad
backward
:
erf_grad
-
api
:
erfinv
args
:
(Tensor x)
output
:
Tensor(out)
infer_meta
:
func
:
UnchangedInferMeta
kernel
:
func
:
erfinv
inplace
:
(x -> out)
backward
:
erfinv_grad
-
api
:
fft_c2c
-
api
:
fft_c2c
args
:
(Tensor x, int64_t[] axes, str normalization, bool forward)
args
:
(Tensor x, int64_t[] axes, str normalization, bool forward)
output
:
Tensor
output
:
Tensor
...
...
paddle/phi/api/yaml/api_compat.yaml
浏览文件 @
76e0926c
...
@@ -86,6 +86,12 @@
...
@@ -86,6 +86,12 @@
outputs
:
outputs
:
out
:
Out
out
:
Out
-
api
:
erfinv
inputs
:
x
:
X
outputs
:
out
:
Out
-
api
:
lgamma
-
api
:
lgamma
inputs
:
inputs
:
x
:
X
x
:
X
...
...
paddle/phi/api/yaml/backward.yaml
浏览文件 @
76e0926c
...
@@ -105,6 +105,16 @@
...
@@ -105,6 +105,16 @@
func
:
erf_grad
func
:
erf_grad
data_type
:
out_grad
data_type
:
out_grad
-
backward_api
:
erfinv_grad
forward
:
erfinv (Tensor x) -> Tensor(out)
args
:
(Tensor out, Tensor out_grad)
output
:
Tensor(x_grad)
infer_meta
:
func
:
UnchangedInferMeta
param
:
[
out
]
kernel
:
func
:
erfinv_grad
-
backward_api
:
fft_c2c_grad
-
backward_api
:
fft_c2c_grad
forward
:
fft_c2c(Tensor x, int64_t[] axes, str normalization, bool forward) -> Tensor(out)
forward
:
fft_c2c(Tensor x, int64_t[] axes, str normalization, bool forward) -> Tensor(out)
args
:
(Tensor out_grad, int64_t[] axes, str normalization, bool forward)
args
:
(Tensor out_grad, int64_t[] axes, str normalization, bool forward)
...
...
paddle/phi/api/yaml/generator/generate_op.py
浏览文件 @
76e0926c
...
@@ -111,6 +111,7 @@ def replace_compat_name(api_op_map, forward_api_dict, backward_api_dict):
...
@@ -111,6 +111,7 @@ def replace_compat_name(api_op_map, forward_api_dict, backward_api_dict):
key
=
args_map
[
key
]
key
=
args_map
[
key
]
if
val
in
args_map
:
if
val
in
args_map
:
val
=
args_map
[
val
]
val
=
args_map
[
val
]
key
,
val
=
val
,
key
inplace_map
[
key
]
=
val
inplace_map
[
key
]
=
val
forward_api_item
[
'inplace'
]
=
inplace_map
forward_api_item
[
'inplace'
]
=
inplace_map
...
...
paddle/phi/api/yaml/generator/tests.py
浏览文件 @
76e0926c
...
@@ -50,7 +50,7 @@ def supports_selected_rows_kernel(api):
...
@@ -50,7 +50,7 @@ def supports_selected_rows_kernel(api):
def
supports_inplace
(
api
):
def
supports_inplace
(
api
):
return
"inplace_map"
in
api
return
api
[
'inplace'
]
is
not
None
def
supports_no_need_buffer
(
api
):
def
supports_no_need_buffer
(
api
):
...
...
paddle/phi/api/yaml/legacy_api.yaml
浏览文件 @
76e0926c
...
@@ -790,16 +790,6 @@
...
@@ -790,16 +790,6 @@
kernel
:
kernel
:
func
:
equal_all
func
:
equal_all
-
api
:
erfinv
args
:
(Tensor x)
output
:
Tensor(out)
infer_meta
:
func
:
UnchangedInferMeta
kernel
:
func
:
erfinv
inplace
:
(x -> out)
backward
:
erfinv_grad
# exp
# exp
-
api
:
exp
-
api
:
exp
args
:
(Tensor x)
args
:
(Tensor x)
...
...
paddle/phi/api/yaml/legacy_backward.yaml
浏览文件 @
76e0926c
...
@@ -740,16 +740,6 @@
...
@@ -740,16 +740,6 @@
output
:
Tensor(weight_grad)
output
:
Tensor(weight_grad)
invoke
:
embedding_grad_impl(x, weight, out_grad, padding_idx, sparse, weight_grad)
invoke
:
embedding_grad_impl(x, weight, out_grad, padding_idx, sparse, weight_grad)
-
backward_api
:
erfinv_grad
forward
:
erfinv (Tensor x) -> Tensor(out)
args
:
(Tensor out, Tensor out_grad)
output
:
Tensor(x_grad)
infer_meta
:
func
:
UnchangedInferMeta
param
:
[
out
]
kernel
:
func
:
erfinv_grad
-
backward_api
:
exp_grad
-
backward_api
:
exp_grad
forward
:
exp (Tensor x) -> Tensor(out)
forward
:
exp (Tensor x) -> Tensor(out)
args
:
(Tensor out, Tensor out_grad)
args
:
(Tensor out, Tensor out_grad)
...
...
paddle/phi/ops/compat/erfinv_sig.cc
已删除
100644 → 0
浏览文件 @
a46d7fe6
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/phi/core/compat/op_utils.h"
namespace
phi
{
KernelSignature
ErfinvGradOpArgumentMapping
(
const
ArgumentMappingContext
&
ctx
)
{
return
KernelSignature
(
"erfinv_grad"
,
{
"Out"
,
"Out@GRAD"
},
{},
{
"X@GRAD"
});
}
}
// namespace phi
PD_REGISTER_ARG_MAPPING_FN
(
erfinv_grad
,
phi
::
ErfinvGradOpArgumentMapping
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录