enhance docstring with code examples
See original GitHub issuemost pytorch modules come with nice examples in the docstring. for example, the docstring of torch.nn.modules.Conv1d
has this block:
Examples::
>>> m = nn.Conv1d(16, 33, 3, stride=2)
>>> input = torch.randn(20, 16, 50)
>>> output = m(input)
.. _cross-correlation:
https://en.wikipedia.org/wiki/Cross-correlation
.. _link:
https://github.com/vdumoulin/conv_arithmetic/blob/master/README.md
these are also available in the autogenerated documentation site:
MONAI’s modules should also include such intuitive examples.
(currently It’s been done for only a few classes, e.g.: https://github.com/Project-MONAI/MONAI/blob/master/monai/transforms/croppad/array.py#L164-L176)
Describe the solution you’d like I understand it’ll be difficult to enforce this feature for all modules. but once it’s there it’ll greatly improve usability. this feature request will probably require multiple PRs.
as a starting point, we could extract some examples from the existing unit tests.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to Use Python Docstrings for Effective Code Documentation
Documenting your code is a critical skill for any data scientist or software engineer. This tutorial will show you how using docstrings.
Read more >Documenting Python Code: A Complete Guide
A complete guide to documenting Python code. Whether you're documenting a small script or a large project, whether you're a beginner or seasoned...
Read more >Python Docstrings Tutorial : Examples & Format for Pydoc ...
Docstrings are similar in spirit to commenting, but they are enhanced, more logical, and useful versions of commenting. Docstrings act as documentation for...
Read more >Python Docstrings (With Examples) - Programiz
Python docstrings are the string literals that appear right after the definition of a function, method, class, or module. Let's take an example....
Read more >Example Google Style Python Docstrings - Napoleon
coding: utf-8 -*- """Example Google style docstrings. This module demonstrates documentation as specified by the `Google Python Style Guide`_.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wyli I was planning to have my team work on some of this as we work through using MONAI on our projects. It is a next item after type hinting is in better shape.
yes, it is, please feel free to create PRs (there’s a
contributing.md
in case you haven’t read it)