Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
587f66ee
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
587f66ee
编写于
6月 05, 2023
作者:
H
huangjiyi
提交者:
GitHub
6月 05, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support code generation for op multiclass_nms3 (#54272)
* update * update eager_gen * update * rm intermediate
上级
8d30a5f3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
86 deletion
+19
-86
paddle/fluid/eager/auto_code_generator/generator/eager_gen.py
...le/fluid/eager/auto_code_generator/generator/eager_gen.py
+3
-0
paddle/fluid/operators/detection/multiclass_nms_op.cc
paddle/fluid/operators/detection/multiclass_nms_op.cc
+0
-41
paddle/phi/api/yaml/legacy_ops.yaml
paddle/phi/api/yaml/legacy_ops.yaml
+0
-9
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+6
-0
paddle/phi/api/yaml/ops.yaml
paddle/phi/api/yaml/ops.yaml
+10
-0
paddle/phi/ops/compat/multiclass_nms3_sig.cc
paddle/phi/ops/compat/multiclass_nms3_sig.cc
+0
-36
未找到文件。
paddle/fluid/eager/auto_code_generator/generator/eager_gen.py
浏览文件 @
587f66ee
...
...
@@ -1469,9 +1469,12 @@ class DygraphForwardFunctionGenerator(DygraphFunctionGeneratorBase):
# Get return type list & outputs
returns_type_list
=
[
""
for
i
in
range
(
num_outputs
)]
returns_list
=
[
""
for
i
in
range
(
num_outputs
)]
num_visited_intermediate_outputs
=
0
for
name
,
(
rtype
,
pos
)
in
forward_outputs_position_map
.
items
():
if
name
in
intermediate_outputs
:
num_visited_intermediate_outputs
+=
1
continue
pos
-=
num_visited_intermediate_outputs
returns_list
[
pos
]
=
f
"
{
name
}
"
if
IsPlainTensorType
(
rtype
):
...
...
paddle/fluid/operators/detection/multiclass_nms_op.cc
浏览文件 @
587f66ee
...
...
@@ -607,45 +607,12 @@ class MultiClassNMS2OpMaker : public MultiClassNMSOpMaker {
}
};
class
MultiClassNMS3Op
:
public
MultiClassNMS2Op
{
public:
MultiClassNMS3Op
(
const
std
::
string
&
type
,
const
framework
::
VariableNameMap
&
inputs
,
const
framework
::
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
)
:
MultiClassNMS2Op
(
type
,
inputs
,
outputs
,
attrs
)
{}
protected:
phi
::
KernelKey
GetExpectedKernelType
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
return
phi
::
KernelKey
(
OperatorWithKernel
::
IndicateVarDataType
(
ctx
,
"Scores"
),
ctx
.
GetPlace
());
}
};
class
MultiClassNMS3OpMaker
:
public
MultiClassNMS2OpMaker
{
public:
void
Make
()
override
{
MultiClassNMS2OpMaker
::
Make
();
AddInput
(
"RoisNum"
,
"(Tensor) The number of RoIs in shape (B),"
"B is the number of images"
)
.
AsDispensable
();
AddOutput
(
"NmsRoisNum"
,
"(Tensor), The number of NMS RoIs in each image"
)
.
AsDispensable
();
}
};
template
<
typename
T
,
typename
DeviceContext
>
class
MultiClassNMS2Kernel
:
public
MultiClassNMSKernel
<
T
,
DeviceContext
>
{};
}
// namespace operators
}
// namespace paddle
DECLARE_INFER_SHAPE_FUNCTOR
(
multiclass_nms3
,
MultiClassNMSShapeFunctor
,
PD_INFER_META
(
phi
::
MultiClassNMSInferMeta
));
namespace
ops
=
paddle
::
operators
;
REGISTER_OPERATOR
(
multiclass_nms
,
...
...
@@ -668,11 +635,3 @@ PD_REGISTER_STRUCT_KERNEL(multiclass_nms2,
ops
::
MultiClassNMS2Kernel
,
float
,
double
)
{}
REGISTER_OPERATOR
(
multiclass_nms3
,
ops
::
MultiClassNMS3Op
,
ops
::
MultiClassNMS3OpMaker
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
framework
::
OpDesc
>
,
paddle
::
framework
::
EmptyGradOpMaker
<
paddle
::
imperative
::
OpBase
>
,
MultiClassNMSShapeFunctor
);
paddle/phi/api/yaml/legacy_ops.yaml
浏览文件 @
587f66ee
...
...
@@ -666,15 +666,6 @@
func
:
mish
backward
:
mish_grad
-
op
:
multiclass_nms3
args
:
(Tensor bboxes, Tensor scores, Tensor rois_num, float score_threshold, int nms_top_k, int keep_top_k, float nms_threshold=0.3, bool normalized=true, float nms_eta=1.0, int background_label=0)
output
:
Tensor(out), Tensor(index), Tensor(nms_rois_num)
infer_meta
:
func
:
MultiClassNMSInferMeta
kernel
:
func
:
multiclass_nms3
optional
:
rois_num
-
op
:
multiply
args
:
(Tensor x, Tensor y)
output
:
Tensor
...
...
paddle/phi/api/yaml/op_compat.yaml
浏览文件 @
587f66ee
...
...
@@ -1702,6 +1702,12 @@
out
:
Out
drop_empty_grad
:
[
x_grad
]
-
op
:
multiclass_nms3
inputs
:
{
bboxes
:
BBoxes
,
scores
:
Scores
,
rois_num
:
RoisNum
}
outputs
:
{
out
:
Out
,
index
:
Index
,
nms_rois_num
:
NmsRoisNum
}
-
op
:
multinomial
inputs
:
{
x
:
X
}
...
...
paddle/phi/api/yaml/ops.yaml
浏览文件 @
587f66ee
...
...
@@ -1548,6 +1548,16 @@
func
:
multi_dot
backward
:
multi_dot_grad
-
op
:
multiclass_nms3
args
:
(Tensor bboxes, Tensor scores, Tensor rois_num, float score_threshold, int nms_top_k, int keep_top_k, float nms_threshold=0.3, bool normalized=true, float nms_eta=1.0, int background_label=0)
output
:
Tensor(out), Tensor(index), Tensor(nms_rois_num)
infer_meta
:
func
:
MultiClassNMSInferMeta
kernel
:
func
:
multiclass_nms3
data_type
:
scores
optional
:
rois_num, nms_rois_num
-
op
:
multinomial
args
:
(Tensor x, Scalar(int) num_samples = 1, bool replacement =
false
)
output
:
Tensor(out)
...
...
paddle/phi/ops/compat/multiclass_nms3_sig.cc
已删除
100644 → 0
浏览文件 @
8d30a5f3
// 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
MultiClassNMS3OpArgumentMapping
(
const
ArgumentMappingContext
&
ctx
UNUSED
)
{
return
KernelSignature
(
"multiclass_nms3"
,
{
"BBoxes"
,
"Scores"
,
"RoisNum"
},
{
"score_threshold"
,
"nms_top_k"
,
"keep_top_k"
,
"nms_threshold"
,
"normalized"
,
"nms_eta"
,
"background_label"
},
{
"Out"
,
"Index"
,
"NmsRoisNum"
});
}
}
// namespace phi
PD_REGISTER_ARG_MAPPING_FN
(
multiclass_nms3
,
phi
::
MultiClassNMS3OpArgumentMapping
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录