Skip to content

Einsum fails with repeated inputs #1217

Closed
@ricardoV94

Description

@ricardoV94

Description

import pytensor.tensor as pt

x = pt.matrix("x")
pt.einsum("ij,ij->i", x, x.copy())  # Fine
pt.einsum("ij,ij->i", x, x)  # Raises
ValueError: The following variables were provided more than once as inputs to the OpFromGraph, resulting in an invalid graph: [x]. Use dummy variables or var.copy() to distinguish variables when creating the OpFromGraph graph.

We should add an x.copy() internally, since this is an implementation detail

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions