Closed
Description
Description of your problem
Found by @ricardoV94, also see #4867 (comment)
Please provide a minimal, self-contained, and reproducible example.
import pymc3 as pm
with pm.Model() as m:
x = pm.Normal('x')
y = pm.Normal('y', x, 1, initval=x)
Please provide the full traceback.
Complete error traceback
TypeError: Expected an array-like object, but found a Variable: maybe you are trying to call a function on a (possibly shared) variable instead of a numeric array?
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-54-6c83ccbaecb6> in <module>
2 with pm.Model() as m:
3 x = pm.Normal('x')
----> 4 y = pm.Normal('y', x, 1, initval=x)
c:\...\pymc3\distributions\distribution.py in __new__(cls, name, rng, dims, initval, observed, total_size, transform, *args, **kwargs)
222 if initval is not None:
223 # Assigning the testval earlier causes trouble because the RV may not be created with the final shape already.
--> 224 rv_out.tag.test_value = initval
225
226 rv_out = model.register_rv(
~\...\aesara\graph\utils.py in __setattr__(self, attr, obj)
265
266 if getattr(self, "attr", None) == attr:
--> 267 obj = self.attr_filter(obj)
268
269 return object.__setattr__(self, attr, obj)
~\...\aesara\tensor\type.py in filter(self, data, strict, allow_downcast)
112 # input (typical mistake, especially with shared variables).
113 if isinstance(data, Variable):
--> 114 raise TypeError(
115 "Expected an array-like object, but found a Variable: "
116 "maybe you are trying to call a function on a (possibly "
TypeError: Expected an array-like object, but found a Variable: maybe you are trying to call a function on a (possibly shared) variable instead of a numeric array?
Please provide any additional information below.
Versions and main components
- PyMC3 Version:
main
- Aesara: 2.1.2