PyTorch Docstring Formatter
Generates and formats standardized PyTorch docstrings following Sphinx and reStructuredText conventions.
The PyTorch Docstring skill provides Claude with domain-specific guidance for writing high-quality documentation within the PyTorch ecosystem. It automates the complex formatting required for PyTorch functions, including raw string usage for LaTeX math, specific signature structures, and standardized sections for arguments, keyword arguments, and examples. By following the conventions found in torch/_tensor_docs.py, this skill ensures that all documentation is consistent, cross-referenced correctly, and ready for Sphinx rendering, making it an essential tool for PyTorch contributors and library maintainers.
Key Features
01Automates function signature formatting with positional and keyword-only arguments
02Creates standardized Args, Keyword Args, and Returns sections with proper indentation
03Generates LaTeX-compliant mathematical formulas using Sphinx math directives
04Supports specialized docstring patterns for C-bound functions and in-place variants
0596,867 GitHub stars
06Implements intelligent cross-referencing for PyTorch classes, functions, and methods
Use Cases
01Documenting new PyTorch native or C++ bound functions with proper reST syntax
02Generating complex tensor shape documentation and mathematical explanations for ML operations
03Updating existing codebase documentation to meet PyTorch's strict formatting standards