-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
tensorflow
: add a few TensorFlow functions
#13364
base: main
Are you sure you want to change the base?
Conversation
4497164
to
bb1e1ca
Compare
bb1e1ca
to
169f785
Compare
add bad_indices_policy arg to gather_nd
169f785
to
43304b7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -403,4 +413,22 @@ def ones_like( | |||
input: RaggedTensor, dtype: DTypeLike | None = None, name: str | None = None, layout: Layout | None = None | |||
) -> RaggedTensor: ... | |||
def reshape(tensor: TensorCompatible, shape: ShapeLike | Tensor, name: str | None = None) -> Tensor: ... | |||
def pad( | |||
tensor: TensorCompatible, | |||
paddings: Tensor | IntArray | Iterable[Iterable[int]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the last two necessary? The docs just specify A Tensor of type int32.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation is more restrictive than what is actually accepted by the function. Removing the last two will likely cause a lot of false positives.
I opened three of the example links, and all 3 of them use lists instead of Tensors.
) -> Tensor: ... | ||
def gather_nd( | ||
params: TensorCompatible, | ||
indices: UIntTensorCompatible, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be TensorCompatible
?
A Tensor. Must be one of the following types: int32, int64. Index tensor.
https://www.tensorflow.org/api_docs/python/tf/gather_nd#args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TensorCompatible
contains str
, which is not a valid type for indices.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
In that case this LGTM |
This PR adds the
tf.round
,tf.pad
,tf.shape
,tf.where
,tf.gather_nd
andtf.signal.hamming_window
functions.