Skip to content
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

fix(ops): sizes == -1 was interpreted incorrectly #218

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

s22chan
Copy link

@s22chan s22chan commented Oct 3, 2024

tf.slice does not act like tf.get_item (eg, python)

from
https://www.tensorflow.org/api_docs/python/tf/slice

If size[i] is -1, all remaining elements in dimension i are included in the slice. In other words, this is equivalent to setting:

size[i] = input_.dim_size(i) - begin[i]

this likely fixes the bfloat optimizations size issues in the TPU Inference Converter as well.

tf.slice does not act like tf.get_item (eg, python)

from 
https://www.tensorflow.org/api_docs/python/tf/slice

> If size[i] is -1, all remaining elements in dimension i are included in the slice. In other words, this is equivalent to setting:

`size[i] = input_.dim_size(i) - begin[i]`

this likely fixes the bfloat optimizations size issues in the TPU Inference Converter as well.
@shaobohou
Copy link
Collaborator

I think this is still not quite right, do you mind if I merge this one instead #220

@s22chan
Copy link
Author

s22chan commented Oct 4, 2024

I don't see any difference other than formatting, but feel free to merge any fix. fyi:

>>> (1+0) if True else 2
1
>>> 1+0 if True else 2
1

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