Skip to content

convert_size wrongly assumes symbolic sizes have to be scalars #5394

Closed
@ricardoV94

Description

@ricardoV94
import pymc as pm
import aesara.tensor as at

s = at.scalar('s')
size = at.stack([s, s])
x = at.random.normal(size=size)
x.eval({s: 2})
# array([[-0.66285345,  0.97341598],
#        [ 0.05158132,  2.03399059]])

pm.Normal.dist(size=size)
# ValueError: The `size` parameter must be a tuple, TensorVariable, int or list. Actual: <class 'aesara.tensor.var.TensorVariable'>

The error comes from this check here:

if isinstance(size, int) or (isinstance(size, TensorVariable) and size.ndim == 0):

CC @michaelosthege

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions