Skip to content

Incorrect shape inferrence for blockwise dot #464

Closed
@aseyboldt

Description

@aseyboldt

Description

It seems some part of the shape inference for blockwise gives incorrect results:

import pytensor
import pytensor.tensor as pt

x = pt.tensor("x", shape=(19, 19))
q = np.random.randn(20, 19)
(q @ x).type
# TensorType(float64, shape=(19, 19))

This gives me (19, 19) on main, when it should be (20, 19).

If I wrap q into a tensor variable I get the correct result:

import pytensor
import pytensor.tensor as pt

x = pt.tensor("x", shape=(19, 19))
q = pt.as_tensor_variable(np.random.randn(20, 19))
(q @ x).type
# TensorType(float64, shape=(20, 19))

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