Skip to content

Conversation

@chiwwang
Copy link
Contributor

We found this while converting an RNN model.

The relay tflite frontend use squeeze at converting unpack, but when the
unpack.axis=0, None is passed to relay.squeeze(), which would squeeze
all dimensions with length 1, causing different results from TFLite.

A possible fix might be, assign the unpack.axis as-is to relay.squeeze()

As for stridedslice, when the tflite frontend handles shrink_axis_mask,
the wrapped begin should be used, instead of the original one which
can be negative. It can cause errors at

ICHECK(strides[i] < 0 ? (end_i <= begin_i) : (begin_i <= end_i))

Related cases are also added to the python test.

Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

We found this while converting an RNN model.

The relay tflite frontend use squeeze at converting unpack, but when the
unpack.axis=0, `None` is passed to relay.squeeze(), which would squeeze
all dimensions with length 1, causing different results from TFLite.

A possible fix might be, assign the unpack.axis as-is to relay.squeeze()

As for stridedslice, when the tflite frontend handles shrink_axis_mask,
the wrapped `begin` should be used, instead of the original one which
can be negative. It can cause errors at
https://github.com/apache/tvm/blob/d65ff6594d4d6db0062537a1d43c0504173b8e5c/include/tvm/topi/detail/strided_slice.h#L140

Related cases are also added to the python test.
@masahi masahi merged commit d8d28bf into apache:main Feb 22, 2022
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
We found this while converting an RNN model.

The relay tflite frontend use squeeze at converting unpack, but when the
unpack.axis=0, `None` is passed to relay.squeeze(), which would squeeze
all dimensions with length 1, causing different results from TFLite.

A possible fix might be, assign the unpack.axis as-is to relay.squeeze()

As for stridedslice, when the tflite frontend handles shrink_axis_mask,
the wrapped `begin` should be used, instead of the original one which
can be negative. It can cause errors at
https://github.com/apache/tvm/blob/d65ff6594d4d6db0062537a1d43c0504173b8e5c/include/tvm/topi/detail/strided_slice.h#L140

Related cases are also added to the python test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants