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

Improved docstring for optax.centralize with explanation and example #1220

Merged

Conversation

shreyans413
Copy link
Contributor

This PR enhances the docstring for optax.centralize by:

Expanding the explanation of gradient centralization and its benefits.
Clarifying that gradients are centralized along the feature dimension.
Adding an example demonstrating how to apply optax.centralize.

Motivation:
The previous docstring was minimal and lacked details on how gradient centralization works. This update provides a clearer explanation and a practical example, making it easier for users to understand and apply the transformation.

Changes Made:
Updated the docstring with a more detailed description of gradient centralization.
Added a code example demonstrating usage with jax.numpy.
Formatted the reference section properly for better readability.

Checklist:
The docstring follows the project's documentation style.
The example is correctly formatted and functional.
The update does not introduce any breaking changes.

Copy link

google-cla bot commented Mar 4, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@shreyans413 shreyans413 force-pushed the centralize-doc-update branch from 0fc18ef to 4457985 Compare March 4, 2025 18:16
@shreyans413 shreyans413 force-pushed the centralize-doc-update branch from 4457985 to dff8021 Compare March 4, 2025 18:28
@vroulet
Copy link
Collaborator

vroulet commented Mar 5, 2025

I'll take care of these changes internally. Thanks @shreyans413 for the PR

@shreyans413
Copy link
Contributor Author

Thanks for handling it! I appreciate the review and the opportunity to contribute. Looking forward to contributing again!

@copybara-service copybara-service bot merged commit fd62d0d into google-deepmind:main Mar 5, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants