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 2019/11/15 04:21:36 UTC

[GitHub] [incubator-tvm] junrushao1994 commented on a change in pull request #4303: [TOPI][Relay][OP] Add a strided_set operation.

junrushao1994 commented on a change in pull request #4303: [TOPI][Relay][OP] Add a strided_set operation.
URL: https://github.com/apache/incubator-tvm/pull/4303#discussion_r346657023
 
 

 ##########
 File path: python/tvm/relay/op/_transform.py
 ##########
 @@ -304,6 +305,31 @@ def compute_argwhere(attrs, inputs, output_type, _):
     new_output_type = tvm.relay.ty.TensorType(output_shape, "int32")
     return [topi.argwhere(new_output_type, inputs[0])]
 
+@_reg.register_compute("strided_set")
+def compute_strided_set(attrs, inputs, output_type, _):
+    """Compute definition of strided_set"""
+    begin = attrs.begin
+    end = attrs.end
+    strides = attrs.strides
+    n = len(inputs[0].shape)
+    ls = len(strides)
+    if ls < n:
+        strides = list(strides)
+        strides[ls:] = [1] * (n - ls)
+    lb = len(begin)
+    if lb < n:
+        begin = list(begin)
+        for i in range(lb, n):
+            begin.append(0 if strides[i] >= 0 else inputs.shape[i])
 
 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:
users@infra.apache.org


With regards,
Apache Git Services