tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] heliqi opened a new issue #5172: [FRONTEND] tensorflow _stridedSlice function error
Date Mon, 30 Mar 2020 10:43:53 GMT
heliqi opened a new issue #5172: [FRONTEND] tensorflow  _stridedSlice function error
URL: https://github.com/apache/incubator-tvm/issues/5172
 
 
   I find a some problems about the _stridedSlice  from relay/frontend/tensorflow.py:
   1. when begin < 0  and shrink_axis_mask > 0 ,end error. example:
   begin = [-1] end= [0] shrink_axis_mask = 1  data_shape = (4,)
   after _transformask,get result: begin = [3] end = [0]. The correct answer would be 'begin
= [3], end = [4]'
   ```
   def _stridedSlice():
       def _impl(inputs, attr, params, mod):
           xxxx
           def _transform_mask(stride_dim, ellipsis_mask):
               xxxx
                       if mask & shrink_axis_mask:
                           #Tensorflow make axis with shrink_axis_mask as dimension 1
                           m_begin[final_index] = data_shape[final_index] + begin[index] \
                                                    if begin[index] < 0 else begin[index]
                           #error
                           m_end[final_index] = begin[index] + 1     =>     m_begin[final_index]
+ 1
                           m_stride[final_index] = 1
                           fshape_indices.append(-2)
                       else:
                           fshape_indices.append(final_index)
   ```
   2. 
   ```
           if not final_output:
               for i_shape in final_output:
                   if i_shape == 0:
                       return _op.squeeze(out)
               if not shrink_axis_mask:
                   ret = out
               else:
                   final_shape = []
                   for dim in out_shape:
                       if dim != 1:
                           final_shape.append(dim)
                   if len(final_shape) == 0:
                       ret = _op.squeeze(out)
                   else:
                       # We need reshape to handle dynamic shape.
                       ret = _op.reshape(out, newshape=tuple(final_shape))
           else:
               #if 0 in  final_output([0],[15,0],etc), should be retrun empty or _op.squeeze(out)
               ret = _op.reshape(out, newshape=tuple(final_output))
   ```
   or  change judge CHECK_LT to CHECK_LE  on  src/relay/op/tensor/transform.cc:StridedSliceRel
and allow begin_i == end_i .

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

Mime
View raw message