Skip to content

torch.meshgrid raises RuntimeError if no arrays are passed #424

@Nin17

Description

@Nin17

If no arrays are passed to torch.meshgrid a RuntimeError is raised whereas numpy returns an empty tuple.

import torch
torch.meshgrid()

raises:

RuntimeError: meshgrid expects a non-empty TensorList

Whereas with numpy:

import numpy as np
np.meshgrid()

returns:

()

I believe the numpy implementation is the correct output given the wording ("tuple of N arrays, where N is the number of provided one-dimensional input arrays") of the docstring for meshgrid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions