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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] use versionadded, versionchanged and deprecated directive #51197

Open
ydcjeff opened this issue Jan 27, 2021 · 5 comments
Open

[docs] use versionadded, versionchanged and deprecated directive #51197

ydcjeff opened this issue Jan 27, 2021 · 5 comments
Labels
feature A request for a proper, new feature. module: docs Related to our documentation, both in docs/ and docblocks triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@ydcjeff
Copy link
Contributor

ydcjeff commented Jan 27, 2021

馃殌 Feature

Use .. versionadded::, .. versionchanged:: and .. deprecated:: directive, so that user knows which features are added / changed / deprecated in which version and they can navigate the docs easily without changing the docs from version to version.

Ref: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-versionadded

I know PyTorch takes a lot of care for documentation, GitHub Release notes.
Most of use read github release notes, too.
But, for those who are not quite get in touch with github release notes, I think it's better to provide those directives so that even if we are in the latest docs, we can know which version to use if we just need a certain feature of pytorch (but, yes we normally use latest version, I think it might help a bit for production use cases.)

After all, this is a suggestion, let me know what pytorch devs think.
Thank you!

cc @jlin27 @mruberry

@ailzhang ailzhang added module: docs Related to our documentation, both in docs/ and docblocks triage review labels Jan 29, 2021
@ailzhang
Copy link
Contributor

Given the amount of deprecated warnings we currently have, this sounds like a great improvement for user experience. Tagging triage review so that we can discuss the priority.

@ezyang ezyang added feature A request for a proper, new feature. triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module and removed triage review labels Feb 1, 2021
@ezyang
Copy link
Contributor

ezyang commented Feb 1, 2021

We definitely should be using deprecated for deprecated features (if we aren't already). It may be difficult to make sure everything is up to date. We might be able to crowdsource historical annotations once we have one or two examples of how to do it.

@ydcjeff
Copy link
Contributor Author

ydcjeff commented Feb 2, 2021

@ezyang Here's the example of output using

Code:

class SiLU(Module):
    r"""Applies the silu function, element-wise.
    ...

    .. versionadded:: 1.7.0  # added this one
    """
class Hardsigmoid(Module):
    r"""Applies the element-wise function:
    ...

    .. versionchanged:: 1.7.0
        Added ``inplace`` option.  # can write any normal RST description we want.
    """
def norm(input, p="fro", dim=None, keepdim=False, out=None, dtype=None):  # noqa: 749
    r"""Returns the matrix norm or vector norm of a given tensor.
    ...

    .. deprecated:: 1.7.0

        torch.norm is deprecated and may be removed in a future PyTorch release.
        Use :func:`torch.linalg.norm` instead, but note that :func:`torch.linalg.norm`
        has a different signature and slightly different behavior that is
        more consistent with NumPy's numpy.linalg.norm.
    """

@mthrok
Copy link
Contributor

mthrok commented Feb 3, 2021

So, do we have a (sort of) agreement of (proactively) using these directives? I do not see a reason not to use them, but with a explicit consensus, domain libraries can start working on it.

@ezyang
Copy link
Contributor

ezyang commented Feb 3, 2021

Yup, go for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A request for a proper, new feature. module: docs Related to our documentation, both in docs/ and docblocks triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

4 participants