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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogenerate parameter types in documentation from python typehints #2125

Merged
merged 1 commit into from
Sep 8, 2022

Commits on Sep 7, 2022

  1. Autogenerate parameter types in documentation from python typehints.

    For example: if the method is...
    
    ```python
    def forward(self, x1: Tensor, x2: Optional[Tensor]) -> Union[Tensor, LinearOperator]:
        r"""
        Does the forward thing.
    
        :param x1: The x1 arg
        :param x2: The x2 arg
        :return: The forward stuff.
        """
        # ...
    ```
    
    The resulting documentation will include the appropriate types:
    
    ```
    Parameters:
    
      - x1 (torch.Tensor) - The x1 arg
      - x2 (torch.Tensor, optional) - The x2 arg
    
    Return type: torch.Tensor or LinearOperator
    
    Returns: The forward stuff.
    ```
    
    This (hopefully) should prevent a lot of duplicate effort on our end.
    
    This commit also refactors the gpytorch.kernels.Kernel and
    gpytorch.distributions.MultivariateNormal docs to utilize
    auto-typing.
    gpleiss committed Sep 7, 2022
    Configuration menu
    Copy the full SHA
    d3b1e91 View commit details
    Browse the repository at this point in the history