Skip to content

Commit fa10f03

Browse files
committed
update code
1 parent 25a0193 commit fa10f03

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

paddle/operators/iou_similarity_op.cc

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class IOUSimilarityOp : public framework::OperatorWithKernel {
3535
PADDLE_ENFORCE_EQ(y_dims.size(), 2UL, "The rank of Input(Y) must be 2.");
3636
PADDLE_ENFORCE_EQ(y_dims[1], 4UL, "The shape of Y is [M, 4]");
3737

38+
ctx->ShareLoD("X", /*->*/ "Out");
3839
ctx->SetOutputDim("Out", framework::make_ddim({x_dims[0], y_dims[0]}));
3940
}
4041
};
@@ -47,29 +48,32 @@ class IOUSimilarityOpMaker : public framework::OpProtoAndCheckerMaker {
4748
"(LoDTensor, default LoDTensor<float>) "
4849
"Box list X is a 2-D LoDTensor with shape [N, 4] holds N boxes, "
4950
"each box is represented as [xmin, ymin, xmax, ymax], "
50-
"the shape of X is [N, 4]. [xmin, ymin] is the lower left "
51-
"coordinate of the box, and [xmax, ymax] is the right upper "
52-
"coordinate of the box.This tensor can contain LoD information "
53-
"to represent a batch of inputs. One instance of this batch can "
54-
"contain different numbers of entities.");
51+
"the shape of X is [N, 4]. [xmin, ymin] is the left top "
52+
"coordinate of the box if the input is image feature map, they "
53+
"are close to the origin of the coordinate system. "
54+
"[xmax, ymax] is the right bottom coordinate of the box. "
55+
"This tensor can contain LoD information to represent a batch "
56+
"of inputs. One instance of this batch can contain different "
57+
"numbers of entities.");
5558
AddInput("Y",
5659
"(Tensor, default Tensor<float>) "
57-
"Box list Y holds M boxes, each box is "
58-
"represented as [xmin, ymin, xmax, ymax], the shape of X is [N, "
59-
"4]. [xmin, ymin] is the lower left coordinate of the box, and "
60-
"[xmax, ymax] is the right upper coordinate of the box.");
60+
"Box list Y holds M boxes, each box is represented as "
61+
"[xmin, ymin, xmax, ymax], the shape of X is [N, 4]. "
62+
"[xmin, ymin] is the left top coordinate of the box if the "
63+
"input is image feature map, and [xmax, ymax] is the right "
64+
"bottom coordinate of the box.");
6165

6266
AddOutput("Out",
63-
"(LoDTensor or Tensor, the lod is same as input X) The output of "
67+
"(LoDTensor, the lod is same as input X) The output of "
6468
"iou_similarity op, a tensor with shape [N, M] "
6569
"representing pairwise iou scores.");
6670

6771
AddComment(R"DOC(
6872
IOU Similarity Operator.
6973
Computes intersection-over-union (IOU) between two box lists.
7074
Box list 'X' should be a LoDTensor and 'Y' is a common Tensor,
71-
boxes in 'Y' are shared by all input images.
72-
Given two box A and B, the calculation of IOU is as follows:
75+
boxes in 'Y' are shared by all instance of the batched inputs of X.
76+
Given two boxes A and B, the calculation of IOU is as follows:
7377
7478
$$
7579
IOU(A, B) =

paddle/operators/iou_similarity_op.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ class IOUSimilarityKernel : public framework::OpKernel<T> {
8383
platform::ForRange<DeviceContext> for_range(
8484
static_cast<const DeviceContext&>(ctx.device_context()), x_n);
8585
for_range(functor);
86-
87-
out->set_lod(in_x->lod());
8886
}
8987
}; // namespace operators
9088

0 commit comments

Comments
 (0)