What problem does it solve?
This Skill ensures that all PyTorch functions and methods have high-quality, consistent docstrings that adhere to project conventions, saving developers time and improving code readability and maintainability.
Core Features & Use Cases
- Convention Adherence: Guides the creation of docstrings following PyTorch's Sphinx/reStructuredText format, including raw strings and specific section ordering.
- Comprehensive Documentation: Ensures inclusion of function signatures, brief descriptions, mathematical formulas, cross-references, arguments, returns, and examples.
- Automated Formatting: Helps structure docstrings with correct indentation, Sphinx roles (e.g.,
:func:, :class:), and LaTeX math notation for tensor shapes.
- Use Case: You've just implemented a new feature in PyTorch and need to document its public API. Instead of spending hours meticulously formatting the docstring and ensuring it meets all PyTorch standards, you use this Skill to generate a perfectly structured and formatted docstring, allowing you to focus on the code itself.
Quick Start
Write a PyTorch docstring for the my_new_function(input: Tensor, dim: int = -1) -> Tensor function, describing its purpose as applying a custom activation and providing an example.