Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Infer RandomVariable broadcastable pattern when size has a Cast #390

@brandonwillard

Description

@brandonwillard

In the following example, the broadcast pattern isn't inferred because of a Cast in size:

import aesara.tensor as at
import aesara.tensor.random.basic as ar


size_at = at.cast([3.0, 1.0], "int64")
# or
# size_at = at.cast([at.scalar(), 1.0], "int64")

norm_at = ar.normal(0, 1, size=size_at)
>>> norm_at.type
TensorType(float64, matrix)

One solution could involve lifting the Cast Op, or—for this exact case—canonicalizing the graph for size would remove the Cast altogether.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions