Add docstrings to layer helper functions and modules#2634
Merged
rwightman merged 5 commits intohuggingface:mainfrom Dec 26, 2025
Merged
Add docstrings to layer helper functions and modules#2634rwightman merged 5 commits intohuggingface:mainfrom
rwightman merged 5 commits intohuggingface:mainfrom
Conversation
Add Google-style docstrings for _ntuple, make_divisible, and extend_tuple to improve code documentation and usage clarity.
Add Google-style docstrings for SpaceToDepth and DepthToSpace layers to document spatial-channel dimension rearrangement operations.
Add Google-style docstrings for get_spatial_dim, get_channel_dim, nchw_to, and nhwc_to functions in layers/format.py.
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Summary
Add Google-style docstrings to helper utilities in
timm/:layers/helpers.py:
_ntuple(),make_divisible(),extend_tuple()layers/space_to_depth.py:
SpaceToDepth,DepthToSpacelayers/format.py:
get_spatial_dim(),get_channel_dim(),nchw_to(),nhwc_to()layers/pool1d.py:
global_pool_nlc()layers/activations_me.py:
swish_fwd(),swish_bwd(),mish_fwd(),mish_bwd(),hard_sigmoid_fwd(),hard_sigmoid_bwd(),hard_swish_fwd(),hard_swish_bwd(),hard_mish_fwd(),hard_mish_bwd()models/_prune.py:
extract_layer(),set_layer(),adapt_model_from_string(),adapt_model_from_file()Core utility functions and modules used throughout the codebase that previously lacked documentation.
Changes
Testing