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/11 07:02:01 UTC

[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #5006: fix bug for slice and tile of relay's frontend for tensorflow

kevinthesun commented on a change in pull request #5006: fix bug for slice and tile of relay's frontend for tensorflow
URL: https://github.com/apache/incubator-tvm/pull/5006#discussion_r390776561
 
 

 ##########
 File path: python/tvm/relay/frontend/tensorflow.py
 ##########
 @@ -784,6 +788,18 @@ def _impl(inputs, attr, params):
             size = _get_list_param(params, inputs[2])
         except (IndexError, KeyError, AttributeError):
             size = _infer_value(inputs[2], params).asnumpy().tolist()[0]
+        
+        # handle situations when return empty constant
+        input0_np = _infer_value_simulated(inputs[0], params).asnumpy()  
+        input0_shape = input0_np.shape
+        for input_dim_i, begin_i, size_i in zip(input0_shape, begin, size):
+            # when one size_i == 0, return empty constant
+            if size_i == 0:
+                return _expr.const([], dtype=input0_np.dtype) 
+            # when begin index larger than the dimension of inputs[0]
+            if begin_i >= input_dim_i:
+                return _expr.const([], dtype=input0_np.dtype) 
 
 Review comment:
   I think strided_slice has already supported empty slice: https://github.com/apache/incubator-tvm/commit/8e2f229a12f5867e17f6328f57a2c86c8bc31ca1#diff-6bbbb63b8fa5dc215443d88cfafed27aL559 

----------------------------------------------------------------
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