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 int given for float args #14900

Conversation

SamuelMarks
Copy link
Contributor

@SamuelMarks SamuelMarks commented Jul 11, 2021

This is the sister commit to tensorflow/tensorflow#49974

I'm writing a parser/emitter that goes from Python to Python (and also OpenAPI). I found some type inconsistencies, when I would run type(func_argument) it would not match the argument type referenced in the docstring. This PR solves one such problem.

PS: Previously when I've tried to commit here I've come across issues, so though it'd be good to start small with a proof-of-concept before going full-throttle. So before I go through the effort of manually making these changes… or extending my ast parser/emitter to automatically make numeric types consistent (between docstring and default/provided argument), I wanted to gain your feedback. Thanks.

EDIT: Ended up going through the codebase and [probably] fixing all the obvious cases

@google-cla google-cla bot added the cla: yes label Jul 11, 2021
…cision/policy_test,premade/linear_test,premade/wide_deep_test}.py] Fix `int` given for `float` args
Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

keras/activations.py Outdated Show resolved Hide resolved
keras/backend.py Outdated Show resolved Hide resolved
keras/backend_test.py Outdated Show resolved Hide resolved
keras/backend_test.py Outdated Show resolved Hide resolved
keras/engine/training_v1.py Outdated Show resolved Hide resolved
Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@fchollet fchollet added kokoro:force-run ready to pull Ready to be merged into the codebase labels Jul 12, 2021
@gbaned gbaned self-assigned this Jul 12, 2021
@copybara-service copybara-service bot merged commit e536eee into keras-team:master Jul 12, 2021
copybara-service bot pushed a commit to tensorflow/tensorflow that referenced this pull request Jul 12, 2021
Imported from GitHub PR keras-team/keras#14900

This is the sister commit to #49974

> I'm writing a parser/emitter that goes from Python to Python (and also OpenAPI). I found some type inconsistencies, when I would run `type(func_argument)` it would not match the argument type referenced in the docstring. This PR solves one such problem.

PS: Previously when I've tried to commit here I've come across issues, so though it'd be good to start small with a proof-of-concept before going full-throttle. So before I go through the effort of manually making these changes… or extending my [`ast`](https://docs.python.org/3/library/ast.html) parser/emitter to automatically make numeric types consistent (between docstring and default/provided argument), I wanted to gain your feedback. Thanks.

EDIT: Ended up going through the codebase and [probably] fixing all the obvious cases
Copybara import of the project:

--
5a61ffc52b231325eda91d2f01c7df2a99d91222 by Samuel Marks <[email protected]>:

[{activations,backend,backend_test}.py] Fix `int` given for `float` args

--
6325142d655bac2724187fa426cb8728563c92f1 by Samuel Marks <[email protected]>:

[keras/{backend,losses,distribute/keras_premade_models_test,mixed_precision/policy_test,premade/linear_test,premade/wide_deep_test}.py] Fix `int` given for `float` args

--
a1cc01da4392729bf379904ffdf6bb1706076867 by Samuel Marks <[email protected]>:

[keras/{engine/training_v1,layers/advanced_activations}.py] Fix `int` given for `float` args

--
24cc55d4245b93ecc9685ee389243ca7002bd196 by Samuel Marks <[email protected]>:

[keras/{activations,backend,backend_test,losses,engine/training_v1,layers/advanced_activations}.py] .0 => 0.

PiperOrigin-RevId: 384311619
Change-Id: I4ac0c2832b21252eeb440bf1b137ca6991ffe1bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes ready to pull Ready to be merged into the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants