Skip to content

Bug: torch.tensordot is not consistent with np.tensordot #65989

@mruberry

Description

@mruberry

Sample program:

a = torch.tensor((1, 2, 3))
b = torch.tensor((4, 5, 6))
torch.tensordot(a, b, dims=0)
: RuntimeError: unsupported input to tensordot, got dims=0

np.tensordot(a, b, axes=0)
: array([[ 4,  5,  6],
             [ 8, 10, 12],
             [12, 15, 18]])

There may be other inconsistencies.

The documentation and examples for torch.tensordot could also use an update. If updating the docs it'd be nice to also add a seealso section and close #50802.

cc @jianyuh @nikitaved @pearu @mruberry @walterddr @IvanYashchuk @xwang233 @lezcano

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: linear algebraIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmultriagedThis 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