-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TFLite] Strided slice handling of shrink_axis_mask improved #6998
[TFLite] Strided slice handling of shrink_axis_mask improved #6998
Conversation
1. Added removal of dimensions if result is a scalar to mimic TensorFlow behaviour. E.g.: tf.strided_slice([1,2,3], [0], [1], [1], shrink_axis_mask=0) <tf.Tensor: shape=(1,), dtype=int32, numpy=array([1], dtype=int32)> tf.strided_slice([[[1,2,3],[4,5,6],[7,8,9]]], [0, 0, 0], [3, 3, 3], [1, 1, 1], shrink_axis_mask=7) <tf.Tensor: shape=(), dtype=int32, numpy=1> 2. Added extra check to assert_allclose to check shape equalities as np.testing.assert_allclose() does not distinguish between cases like: np.testing.assert_allclose(1, np.array(1)) np.testing.assert_allclose(1, np.array([1])) np.testing.assert_allclose(np.array(1), np.array([1]))
Ping. How can we make some progress here? |
I'm not familiar with TFLite frontend. cc @siju-samuel @FrozenGene |
bump cc @siju-samuel @FrozenGene |
How can we make a progress here? |
@d-smirnov I will review it today, thanks! |
please fix ci problem |
…6998) * [TFLite] Strided slice handlig of shrink_axis_mask improved 1. Added removal of dimensions if result is a scalar to mimic TensorFlow behaviour. E.g.: tf.strided_slice([1,2,3], [0], [1], [1], shrink_axis_mask=0) <tf.Tensor: shape=(1,), dtype=int32, numpy=array([1], dtype=int32)> tf.strided_slice([[[1,2,3],[4,5,6],[7,8,9]]], [0, 0, 0], [3, 3, 3], [1, 1, 1], shrink_axis_mask=7) <tf.Tensor: shape=(), dtype=int32, numpy=1> 2. Added extra check to assert_allclose to check shape equalities as np.testing.assert_allclose() does not distinguish between cases like: np.testing.assert_allclose(1, np.array(1)) np.testing.assert_allclose(1, np.array([1])) np.testing.assert_allclose(np.array(1), np.array([1])) * unit tests fixed
…6998) * [TFLite] Strided slice handlig of shrink_axis_mask improved 1. Added removal of dimensions if result is a scalar to mimic TensorFlow behaviour. E.g.: tf.strided_slice([1,2,3], [0], [1], [1], shrink_axis_mask=0) <tf.Tensor: shape=(1,), dtype=int32, numpy=array([1], dtype=int32)> tf.strided_slice([[[1,2,3],[4,5,6],[7,8,9]]], [0, 0, 0], [3, 3, 3], [1, 1, 1], shrink_axis_mask=7) <tf.Tensor: shape=(), dtype=int32, numpy=1> 2. Added extra check to assert_allclose to check shape equalities as np.testing.assert_allclose() does not distinguish between cases like: np.testing.assert_allclose(1, np.array(1)) np.testing.assert_allclose(1, np.array([1])) np.testing.assert_allclose(np.array(1), np.array([1])) * unit tests fixed
…6998) * [TFLite] Strided slice handlig of shrink_axis_mask improved 1. Added removal of dimensions if result is a scalar to mimic TensorFlow behaviour. E.g.: tf.strided_slice([1,2,3], [0], [1], [1], shrink_axis_mask=0) <tf.Tensor: shape=(1,), dtype=int32, numpy=array([1], dtype=int32)> tf.strided_slice([[[1,2,3],[4,5,6],[7,8,9]]], [0, 0, 0], [3, 3, 3], [1, 1, 1], shrink_axis_mask=7) <tf.Tensor: shape=(), dtype=int32, numpy=1> 2. Added extra check to assert_allclose to check shape equalities as np.testing.assert_allclose() does not distinguish between cases like: np.testing.assert_allclose(1, np.array(1)) np.testing.assert_allclose(1, np.array([1])) np.testing.assert_allclose(np.array(1), np.array([1])) * unit tests fixed
…6998) * [TFLite] Strided slice handlig of shrink_axis_mask improved 1. Added removal of dimensions if result is a scalar to mimic TensorFlow behaviour. E.g.: tf.strided_slice([1,2,3], [0], [1], [1], shrink_axis_mask=0) <tf.Tensor: shape=(1,), dtype=int32, numpy=array([1], dtype=int32)> tf.strided_slice([[[1,2,3],[4,5,6],[7,8,9]]], [0, 0, 0], [3, 3, 3], [1, 1, 1], shrink_axis_mask=7) <tf.Tensor: shape=(), dtype=int32, numpy=1> 2. Added extra check to assert_allclose to check shape equalities as np.testing.assert_allclose() does not distinguish between cases like: np.testing.assert_allclose(1, np.array(1)) np.testing.assert_allclose(1, np.array([1])) np.testing.assert_allclose(np.array(1), np.array([1])) * unit tests fixed
Added removal of dimensions if result is a scalar
to mimic TensorFlow behaviour. E.g.:
tf.strided_slice([1,2,3], [0], [1], [1], shrink_axis_mask=0)
<tf.Tensor: shape=(1,), dtype=int32, numpy=array([1], dtype=int32)>
tf.strided_slice([[[1,2,3],[4,5,6],[7,8,9]]], [0, 0, 0], [3, 3, 3], [1, 1, 1], shrink_axis_mask=7)
<tf.Tensor: shape=(), dtype=int32, numpy=1>
Added extra check to assert_allclose to check shape equalities
as np.testing.assert_allclose() does not distinguish between cases like:
np.testing.assert_allclose(1, np.array(1))
np.testing.assert_allclose(1, np.array([1]))
np.testing.assert_allclose(np.array(1), np.array([1]))