You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/03/21 03:27:14 UTC
[GitHub] [incubator-tvm] kazum commented on a change in pull request #5116:
Add thrust support for nms
kazum commented on a change in pull request #5116: Add thrust support for nms
URL: https://github.com/apache/incubator-tvm/pull/5116#discussion_r395956862
##########
File path: topi/python/topi/cuda/sort.py
##########
@@ -237,6 +237,51 @@ def sort_nms_ir(data, valid_count, output, axis, is_ascend):
return ib.get()
+def argsort_nms_thrust(data, valid_count, axis=-1, is_ascend=1, dtype="float32"):
+ """Performs sorting along the given axis and returns an array of indicies
+ having same shape as an input array that index data in sorted order.
+
+ Parameters
+ ----------
+ data: tvm.te.Tensor
+ The input array.
+
+ valid_count : tvm.te.Tensor, optional
+ The number of valid elements to be sorted.
+
+ axis : int, optional
+ Axis long which to sort the input tensor.
+
+ is_ascend : boolean, optional
+ Whether to sort in ascending or descending order.
+
+ dtype : string, optional
+ DType of the output indices.
+
+ Returns
+ -------
+ out : tvm.te.Tensor
+ The output of this function.
+ """
+ data_buf = tvm.tir.decl_buffer(data.shape, data.dtype, "data_buf",
+ data_alignment=8)
+ valid_count_buf = tvm.tir.decl_buffer(valid_count.shape, valid_count.dtype,
+ "valid_count_buf", data_alignment=4)
+ out_bufs = [
+ tvm.tir.decl_buffer(data.shape, data.dtype, "value_buf", data_alignment=8),
+ tvm.tir.decl_buffer(data.shape, "int32", "indices_buf", data_alignment=8)
+ ]
+ out = te.extern([data.shape, data.shape],
+ [data, valid_count],
+ lambda ins, outs: tvm.tir.call_packed(
+ "tvm.contrib.thrust.sort_nms", ins[0], ins[1], outs[0], outs[1], is_ascend),
Review comment:
thrust_sort_nms() supports only axis -1.
Should we add `assert(axis == -1)`?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services