Uh oh!
There was an error while loading. Please reload this page.
[Bugfix][Frontend][TF] Fix incorrect calculations in tf SLICE - #4518
Merged
Conversation
inadob
commented
Dec 13, 2019
ContributorAuthor
@kevinthesun@FrozenGene can you please review this patch |
| def test_forward_slice(): | ||
| _test_forward_slice_operation_input([1, 1], 0, 2) | ||
| _test_forward_slice_operation_input([1, 1], [0], [2]) |
Contributor
There was a problem hiding this comment.
Is it better to add below lines inside _test_forward_slice_operation_input to also accept begin_value, size_value input as a single int?
begin_value = [begin_value] if isinstance(begin_value, int) else begin_value
size_value = [size_value] if isinstance(size_value, int) else size_value
ContributorAuthor
There was a problem hiding this comment.
Well, in the TF documentation is said that tf.slice() arguments begin & size both should be tensors. I am aware that the scalars are 0D tensors but if the TF function, in general, doesn't accept scalars, then from my point of view, it doesn't make sense to test something that is not supposed to work like this.
Uh oh!
There was an error while loading. Please reload this page.
* fix formula for calculating end indices when size[i] == -1 * add a test case for size[i] == -1 * discard expanding dimension of begin_value & end_value since it is needed only if you pass them as scalars not as tensors. * discard 'slice_tensor' variable so that implementation matches the tf parser pattern
kevinthesun
commented
Jan 24, 2020
Contributor
Thanks @optima2005@inadob |
alexwong pushed a commit
to alexwong/tvm
that referenced
this pull request
Feb 26, 2020
…#4518) * fix formula for calculating end indices when size[i] == -1 * add a test case for size[i] == -1 * discard expanding dimension of begin_value & end_value since it is needed only if you pass them as scalars not as tensors. * discard 'slice_tensor' variable so that implementation matches the tf parser pattern
alexwong pushed a commit
to alexwong/tvm
that referenced
this pull request
Feb 28, 2020
…#4518) * fix formula for calculating end indices when size[i] == -1 * add a test case for size[i] == -1 * discard expanding dimension of begin_value & end_value since it is needed only if you pass them as scalars not as tensors. * discard 'slice_tensor' variable so that implementation matches the tf parser pattern
zhiics pushed a commit
to neo-ai/tvm
that referenced
this pull request
Mar 2, 2020
…#4518) * fix formula for calculating end indices when size[i] == -1 * add a test case for size[i] == -1 * discard expanding dimension of begin_value & end_value since it is needed only if you pass them as scalars not as tensors. * discard 'slice_tensor' variable so that implementation matches the tf parser pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
it is needed only if you pass them as scalars, not as tensors. [Relay][Frontend][TF] Fix slice when begin or size is not Const #4372
the TF parser pattern