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

Improve "Defaults to" by putting to end of arg in docstring and ensuring backticks have proper spacing #18945

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SamuelMarks
Copy link
Contributor

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 :)

…{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-commenter
Copy link

codecov-commenter commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.38%. Comparing base (1941c30) to head (b470eee).

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           
Flag Coverage Δ
keras 78.22% <ø> (ø)
keras-jax 62.01% <ø> (ø)
keras-numpy 56.34% <ø> (ø)
keras-tensorflow 63.36% <ø> (ø)
keras-torch 62.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Dec 15, 2023
@gbaned gbaned requested a review from nkovela1 December 15, 2023 03:30
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!

@@ -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 `()`.
Copy link
Member

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`.
Copy link
Member

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.

Copy link
Contributor Author

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

@sachinprasadhs
Copy link
Collaborator

Please rebase the code to follow the latest code structure /keras/src/..

@sachinprasadhs sachinprasadhs added stat:awaiting response from contributor and removed stat:awaiting keras-eng Awaiting response from Keras engineer labels May 1, 2024
# Conflicts:
#	keras/src/layers/layer.py
#	keras/src/optimizers/base_optimizer.py
#	keras/src/utils/argument_validation.py
@SamuelMarks
Copy link
Contributor Author

@sachinprasadhs No problem. Merged and resolved conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PR Queue
Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

None yet

5 participants