Originally posted by **ricardoV94** July 9, 2022
We have a common check in multivariate distributions (+ categorical), that raises when a non-size is not strictly equal to the batched dimensions of the parameters, saying objects cannot be broadcast to a single shape.
https://github.com/aesara-devs/aesara/blob/510a9618454293fc00b3cfa78b337c1f2d6d2af3/aesara/tensor/random/basic.py#L377-L383
I don't know why we are imposing this limitation. Even if there is a good reason, the message is wrong, because the batched shapes may very well be broadcastable to size:
```python
# Raises ValueError: shape mismatch: objects cannot be broadcast to a single shape
# However batch_shape=(1,) and size=(5,) are clearly broadcastable
at.random.dirichlet([[0.2, 0.3, 0.5]], size=5).eval()
```
The message for the CategoricalRV is more accurate:
https://github.com/aesara-devs/aesara/blob/510a9618454293fc00b3cfa78b337c1f2d6d2af3/aesara/tensor/random/basic.py#L651-L652
However I still don't get why we would not broadcast the parameter to match size, when this is would be valid. Otherwise, the following should also be invalid, no?
```python
# Just fine
at.random.normal([0], size=5).eval()
```
Discussed in https://github.com/aesara-devs/aesara/discussions/1044