WHAT
StridedSlice can be converted into Reshape, e.g.,
A = input of shape [1, 1, 1, 32]
B = StridedSlice(A, begin =[0,0,0,0], end=[1,1,1,32], shrinkAxisMask=0b0001)
is same with
A = input of shape [1, 1, 1, 32]
C = Reshape(A, [1,1,32])
WHY
In backend, implementation of Reshape is generally simpler than that of strided_slice.
Therefore, converting strided_slice to reshape in this case could generally improve performance.
Condition
With a op below,
If all conditions below are true
Convert strided_slice to the following Reshape
Where to implement
I found
Likewise, can I make the following option?
arser.add_argument("--substitute_strided_slice_to_reshape")
@hyunsik-yoon , please add a test in circle2circle-dredd-recipe-test to check it's working.
/cc @jinevening This optimization is enable GRU we're trying to enable these days.
all done.
Most helpful comment
Where to implement
I found
https://github.com/Samsung/ONE/blob/2dc8f730a5184f96a59b0cf57833d0228f8e1741/compiler/circle2circle/src/Circle2Circle.cpp#L198-L202
Likewise, can I make the following option?