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/13 03:06:09 UTC

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

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

 ##########
 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:
   You are right. Probably I tested on a outdated copy of the TVM. I will close this PR and thanks.

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