From fa10f03f92136864d4fed37d010ad46ae54bb52b Mon Sep 17 00:00:00 2001 From: wanghaox Date: Tue, 23 Jan 2018 17:00:31 +0800 Subject: [PATCH] update code --- paddle/operators/iou_similarity_op.cc | 28 +++++++++++++++------------ paddle/operators/iou_similarity_op.h | 2 -- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/paddle/operators/iou_similarity_op.cc b/paddle/operators/iou_similarity_op.cc index 6c1b99b46f..c520b28b83 100755 --- a/paddle/operators/iou_similarity_op.cc +++ b/paddle/operators/iou_similarity_op.cc @@ -35,6 +35,7 @@ class IOUSimilarityOp : public framework::OperatorWithKernel { PADDLE_ENFORCE_EQ(y_dims.size(), 2UL, "The rank of Input(Y) must be 2."); PADDLE_ENFORCE_EQ(y_dims[1], 4UL, "The shape of Y is [M, 4]"); + ctx->ShareLoD("X", /*->*/ "Out"); ctx->SetOutputDim("Out", framework::make_ddim({x_dims[0], y_dims[0]})); } }; @@ -47,20 +48,23 @@ class IOUSimilarityOpMaker : public framework::OpProtoAndCheckerMaker { "(LoDTensor, default LoDTensor) " "Box list X is a 2-D LoDTensor with shape [N, 4] holds N boxes, " "each box is represented as [xmin, ymin, xmax, ymax], " - "the shape of X is [N, 4]. [xmin, ymin] is the lower left " - "coordinate of the box, and [xmax, ymax] is the right upper " - "coordinate of the box.This tensor can contain LoD information " - "to represent a batch of inputs. One instance of this batch can " - "contain different numbers of entities."); + "the shape of X is [N, 4]. [xmin, ymin] is the left top " + "coordinate of the box if the input is image feature map, they " + "are close to the origin of the coordinate system. " + "[xmax, ymax] is the right bottom coordinate of the box. " + "This tensor can contain LoD information to represent a batch " + "of inputs. One instance of this batch can contain different " + "numbers of entities."); AddInput("Y", "(Tensor, default Tensor) " - "Box list Y holds M boxes, each box is " - "represented as [xmin, ymin, xmax, ymax], the shape of X is [N, " - "4]. [xmin, ymin] is the lower left coordinate of the box, and " - "[xmax, ymax] is the right upper coordinate of the box."); + "Box list Y holds M boxes, each box is represented as " + "[xmin, ymin, xmax, ymax], the shape of X is [N, 4]. " + "[xmin, ymin] is the left top coordinate of the box if the " + "input is image feature map, and [xmax, ymax] is the right " + "bottom coordinate of the box."); AddOutput("Out", - "(LoDTensor or Tensor, the lod is same as input X) The output of " + "(LoDTensor, the lod is same as input X) The output of " "iou_similarity op, a tensor with shape [N, M] " "representing pairwise iou scores."); @@ -68,8 +72,8 @@ class IOUSimilarityOpMaker : public framework::OpProtoAndCheckerMaker { IOU Similarity Operator. Computes intersection-over-union (IOU) between two box lists. Box list 'X' should be a LoDTensor and 'Y' is a common Tensor, - boxes in 'Y' are shared by all input images. - Given two box A and B, the calculation of IOU is as follows: + boxes in 'Y' are shared by all instance of the batched inputs of X. + Given two boxes A and B, the calculation of IOU is as follows: $$ IOU(A, B) = diff --git a/paddle/operators/iou_similarity_op.h b/paddle/operators/iou_similarity_op.h index f42e05b078..e36177069d 100644 --- a/paddle/operators/iou_similarity_op.h +++ b/paddle/operators/iou_similarity_op.h @@ -83,8 +83,6 @@ class IOUSimilarityKernel : public framework::OpKernel { platform::ForRange for_range( static_cast(ctx.device_context()), x_n); for_range(functor); - - out->set_lod(in_x->lod()); } }; // namespace operators -- GitLab