Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
530df1b2
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
530df1b2
编写于
1月 22, 2018
作者:
D
dangqingqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the naming.
上级
07908686
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
9 deletion
+9
-9
paddle/operators/bipartite_match_op.cc
paddle/operators/bipartite_match_op.cc
+9
-9
未找到文件。
paddle/operators/bipartite_match_op.cc
浏览文件 @
530df1b2
...
...
@@ -28,11 +28,11 @@ class BipartiteMatchOp : public framework::OperatorWithKernel {
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"DisMat"
),
"Input(DisMat) of BipartiteMatch should not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"Dis
t
Mat"
),
"Input(Dis
t
Mat) of BipartiteMatch should not be null."
);
auto
dims
=
ctx
->
GetInputDim
(
"DisMat"
);
PADDLE_ENFORCE_EQ
(
dims
.
size
(),
2
,
"The rank of Input(DisMat) must be 2."
);
auto
dims
=
ctx
->
GetInputDim
(
"Dis
t
Mat"
);
PADDLE_ENFORCE_EQ
(
dims
.
size
(),
2
,
"The rank of Input(Dis
t
Mat) must be 2."
);
ctx
->
SetOutputDim
(
"ColToRowMatchIndices"
,
dims
);
ctx
->
SetOutputDim
(
"ColToRowMatchDis"
,
dims
);
...
...
@@ -90,7 +90,7 @@ class BipartiteMatchKernel : public framework::OpKernel<T> {
}
void
Compute
(
const
framework
::
ExecutionContext
&
context
)
const
override
{
auto
*
dist_mat
=
context
.
Input
<
LoDTensor
>
(
"DisMat"
);
auto
*
dist_mat
=
context
.
Input
<
LoDTensor
>
(
"Dis
t
Mat"
);
auto
*
match_indices
=
context
.
Output
<
Tensor
>
(
"ColToRowMatchIndices"
);
auto
*
match_dist
=
context
.
Output
<
Tensor
>
(
"ColToRowMatchDis"
);
...
...
@@ -132,12 +132,12 @@ class BipartiteMatchOpMaker : public framework::OpProtoAndCheckerMaker {
BipartiteMatchOpMaker
(
OpProto
*
proto
,
OpAttrChecker
*
op_checker
)
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
AddInput
(
"DisMat"
,
"Dis
t
Mat"
,
"(LoDTensor or Tensor) this input is a 2-D LoDTensor with shape "
"[K, M]. It is pair-wise distance matrix between the entities "
"represented by each row and each column. For example, assumed one "
"entity is A with shape [K], another entity is B with shape [M]. The "
"DisMat[i][j] is the distance between A[i] and B[j]. The bigger "
"Dis
t
Mat[i][j] is the distance between A[i] and B[j]. The bigger "
"the distance is, the better macthing the pairs are. Please note, "
"This tensor can contain LoD information to represent a batch of "
"inputs. One instance of this batch can contain different numbers of "
...
...
@@ -155,7 +155,7 @@ class BipartiteMatchOpMaker : public framework::OpProtoAndCheckerMaker {
"ColToRowMatchDis[i][j] is also -1.0. Otherwise, assumed "
"ColToRowMatchIndices[i][j] = d, and the row offsets of each "
"instance are called LoD. Then "
"ColToRowMatchDis[i][j] = DisMat[d+LoD[i]][j]"
);
"ColToRowMatchDis[i][j] = Dis
t
Mat[d+LoD[i]][j]"
);
AddComment
(
R"DOC(
This operator is a greedy bipartite matching algorithm, which is used to
obtain the matching with the maximum distance based on the input
...
...
@@ -171,7 +171,7 @@ row entity to the column entity and the matched indices are not duplicated
in each row of ColToRowMatchIndices. If the column entity is not matched
any row entity, set -1 in ColToRowMatchIndices.
Please note that the input DisMat can be LoDTensor (with LoD) or Tensor.
Please note that the input Dis
t
Mat can be LoDTensor (with LoD) or Tensor.
If LoDTensor with LoD, the height of ColToRowMatchIndices is batch size.
If Tensor, the height of ColToRowMatchIndices is 1.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录