| 109 | } |
| 110 | |
| 111 | Status NMSShapeFn(InferenceContext* c) { |
| 112 | // Get inputs and validate ranks. |
| 113 | ShapeHandle boxes; |
| 114 | TF_RETURN_IF_ERROR(c->WithRank(c->input(0), 2, &boxes)); |
| 115 | ShapeHandle scores; |
| 116 | TF_RETURN_IF_ERROR(c->WithRank(c->input(1), 1, &scores)); |
| 117 | ShapeHandle max_output_size; |
| 118 | TF_RETURN_IF_ERROR(c->WithRank(c->input(2), 0, &max_output_size)); |
| 119 | ShapeHandle iou_threshold; |
| 120 | TF_RETURN_IF_ERROR(c->WithRank(c->input(3), 0, &iou_threshold)); |
| 121 | ShapeHandle score_threshold; |
| 122 | TF_RETURN_IF_ERROR(c->WithRank(c->input(4), 0, &score_threshold)); |
| 123 | // The boxes is a 2-D float Tensor of shape [num_boxes, 4]. |
| 124 | DimensionHandle unused; |
| 125 | // The boxes[0] and scores[0] are both num_boxes. |
| 126 | TF_RETURN_IF_ERROR(c->Merge(c->Dim(boxes, 0), c->Dim(scores, 0), &unused)); |
| 127 | // The boxes[1] is 4. |
| 128 | TF_RETURN_IF_ERROR(c->WithValue(c->Dim(boxes, 1), 4, &unused)); |
| 129 | |
| 130 | c->set_output(0, c->Vector(c->UnknownDim())); |
| 131 | return Status::OK(); |
| 132 | } |
| 133 | |
| 134 | Status SoftNMSShapeFn(InferenceContext* c) { |
| 135 | // Get inputs and validate ranks. |
no test coverage detected