Skip to content

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

Open
s22chan wants to merge 1 commit into
google-deepmind:mainfrom
s22chan:fix/slice-all
Open

s22chan wants to merge 1 commit into
google-deepmind:mainfrom
s22chan:fix/slice-all

Conversation

@s22chan

@s22chan s22chan commented Oct 3, 2024

Copy link
Copy Markdown

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
Copy Markdown
Collaborator

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

@s22chan

s22chan commented Oct 4, 2024

Copy link
Copy Markdown
Author

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