Skip to content

The doc of linalg.vector_norm() should say there is x or input parameterΒ #136560

@hyperkai

Description

@hyperkai

πŸ“š The doc issue

The doc of linalg.vector_norm() says there is x parameter as shown below:

torch.linalg.vector_norm(x, ord=2, dim=None, keepdim=False, *, dtype=None, out=None) β†’ Tensor

x (Tensor) – tensor, flattened by default, but this behavior can be controlled using dim.

Then, x parameter works and input parameter also works as shown below:

import torch
from torch import linalg

my_tensor = torch.tensor([-2., -1., 0., 1., 2., 3.])

linalg.vector_norm(x=my_tensor) # tensor(4.3589)
linalg.vector_norm(input=my_tensor) # tensor(4.3589)

Suggest a potential alternative/fix

The doc of linalg.vector_norm() should say there is x or input parameter as shown below:

torch.linalg.vector_norm(x or input, ord=2, dim=None, keepdim=False, *, dtype=None, out=None) β†’ Tensor

x or input (Tensor) – tensor, flattened by default, but this behavior can be controlled using dim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: norms and normalizationtopic: docstopic categorytriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions