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
Improve "Defaults to" by putting to end of arg in docstring and ensuring backticks have proper spacing #18945
base: master
Are you sure you want to change the base?
Improve "Defaults to" by putting to end of arg in docstring and ensuring backticks have proper spacing #18945
Conversation
…{math.py,nn.py,numpy.py},optimizers/base_optimizer.py,utils/{argument_validation.py,audio_dataset_utils.py,image_dataset_utils.py,image_utils.py,sequence_utils.py,text_dataset_utils.py}}] Improve "Defaults to" by putting to end of arg in docstring and ensuring backticks have proper spacing
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #18945 +/- ##
=======================================
Coverage 78.38% 78.38%
=======================================
Files 498 498
Lines 45520 45520
Branches 8393 8393
=======================================
Hits 35679 35679
Misses 8102 8102
Partials 1739 1739
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thanks for the PR!
keras/layers/layer.py
Outdated
@@ -459,7 +460,7 @@ def add_weight( | |||
Args: | |||
shape: Shape tuple for the variable. | |||
Must be fully-defined (no `None` entries). | |||
Defaults to `()` (scalar) if unspecified. | |||
(scalar) if unspecified. Defaults to `()`. |
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 "(scalar) if unspecified" should go afterwards
keras/ops/nn.py
Outdated
axis: Axis along which the encoding is performed. Defaults to | ||
`-1`, which represents the last axis. | ||
axis: Axis along which the encoding is performed. | ||
`-1` represents the last axis. Defaults to `-1`. |
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.
Again, "which represents..." should go afterwards.
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.
I will move it if you request again, however there is ambiguity if "defaults to" isn't the final part of the argument. E.g., see https://github.com/keras-team/keras/blob/b6618f7/keras/utils/dataset_utils.py#L24-L28. Although there is no concrete specification of the Google doc format, in Sphinx they put "Defaults to" at the end of the argument: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
Please rebase the code to follow the latest code structure /keras/src/.. |
# Conflicts: # keras/src/layers/layer.py # keras/src/optimizers/base_optimizer.py # keras/src/utils/argument_validation.py
@sachinprasadhs No problem. Merged and resolved conflicts. |
If you prefer I can change all arguments to be how the popular Sphinx documentation generator parser works: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
EDIT - Actually created a separate issue to discuss this #18944
Made much smaller and fewer changes than my previous (similar) PRs to improve chance of merging without controversy :)