Laurawly commented on a change in pull request #4312: [TOPI][Relay][OP] Dynamic
NMS and strided_slice
URL: https://github.com/apache/incubator-tvm/pull/4312#discussion_r345514450
##########
File path: python/tvm/relay/frontend/tensorflow.py
##########
@@ -324,6 +325,53 @@ def _impl(inputs, attr, params):
return out
return _impl
+def _nms():
+ def _impl(inputs, attr, params):
+ # Get parameter values
+ max_output_size =
int(np.atleast_1d(inputs[2].data.asnumpy().astype("int64"))[0])
+ iou_threshold = np.atleast_1d(inputs[3].data.asnumpy())[0]
+ # score_threshold was introduced from V3
+ score_threshold = np.atleast_1d(inputs[4].data.asnumpy())[0] if
len(inputs) > 4 else None
+
+ scores = AttrCvt(op_name="expand_dims",
+ extras={'axis': -1, 'num_newaxis': 1})([inputs[1]],
attr)
+
+ data = get_relay_op('concatenate')([scores, inputs[0]], -1)
+ # expand to [class_id, prob, box]
+ # data = _get_relay_op('concatenate')([scores, data], -1)
+ # expand to [batch_size, num_anchors, 6] or [batch_size, num_anchors,
5]
+
+ data = get_relay_op('expand_dims')(data, 0, 1)
+
+ # Don't need to call get_valid_counts for TensorFlow and ONNX
+ # ct, data = _get_relay_op('get_valid_counts')(data,
score_threshold=score_threshold,
Review comment:
Same here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services