tensorflow: Add some tf.raw_ops members.#11387
Merged
JelleZijlstra merged 3 commits intopython:mainfrom Feb 17, 2024
Merged
Conversation
82e89af to
e6160ae
Compare
This comment has been minimized.
This comment has been minimized.
Comment on lines
+22
to
+23
| lr: TensorCompatible, | ||
| epsilon: TensorCompatible, |
Member
There was a problem hiding this comment.
These two must be scalars, so perhaps we can give narrower type (optional)
Contributor
Author
There was a problem hiding this comment.
I don't have code to run this function, so I can't check, but very often the TensorFlow doc says that the input must be a scalar, but anything that can be converted to a scalar will do. So for example it will say that a float32 is required but "1.2" would work. However that behavior isn't consistent, so we can't know without testing.
For example:
import tensorflow as tf
tf.keras.optimizers.Adam(learning_rate="1.0") # Raises ValueError
tf.keras.optimizers.Adam(epsilon="1.0") # WorksSo far I think most of the typing for TensorFlow is using overly lax typing for the inputs in order to avoid false positives, so I would leave TensorCompatible.
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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 free
to 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.
Stubs taken from here.