I’m trying to run the code example from @ricardoV94 above but getting this error:
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
Cell In[47], line 16
13 return next_state, {old_rng: next_rng}
15 rng = aesara.shared(np.random.default_rng())
---> 16 mc_chain, updates = aesara.scan(fn=transition,
17 outputs_info=dict(initial = initial_state),
18 non_sequences=[transition_probs, rng],
19 n_steps=k)
20 assert updates
21 markov_chain.register_rv(mc_chain, name="mc_chain", initval="prior")
File ~/opt/anaconda3/envs/pymc/lib/python3.11/site-packages/aesara/scan/basic.py:464, in scan(fn, sequences, outputs_info, non_sequences, n_steps, truncate_gradient, go_backwards, mode, name, profile, allow_gc, strict, return_list)
462 for elem in wrap_into_list(non_sequences):
463 if not isinstance(elem, Variable):
--> 464 non_seqs.append(at.as_tensor_variable(elem))
465 else:
466 non_seqs.append(elem)
File ~/opt/anaconda3/envs/pymc/lib/python3.11/site-packages/aesara/tensor/__init__.py:49, in as_tensor_variable(x, name, ndim, **kwargs)
17 def as_tensor_variable(
18 x: TensorLike, name: Optional[str] = None, ndim: Optional[int] = None, **kwargs
19 ) -> "TensorVariable":
20 """Convert `x` into an equivalent `TensorVariable`.
21
22 This function can be used to turn ndarrays, numbers, `ScalarType` instances,
(...)
47
48 """
---> 49 return _as_tensor_variable(x, name, ndim, **kwargs)
File ~/opt/anaconda3/envs/pymc/lib/python3.11/functools.py:909, in singledispatch.<locals>.wrapper(*args, **kw)
905 if not args:
906 raise TypeError(f'{funcname} requires at least '
907 '1 positional argument')
--> 909 return dispatch(args[0].__class__)(*args, **kw)
File ~/opt/anaconda3/envs/pymc/lib/python3.11/site-packages/aesara/tensor/__init__.py:56, in _as_tensor_variable(x, name, ndim, **kwargs)
52 @singledispatch
53 def _as_tensor_variable(
54 x: TensorLike, name: Optional[str], ndim: Optional[int], **kwargs
55 ) -> "TensorVariable":
---> 56 raise NotImplementedError(f"Cannot convert {x!r} to a tensor variable.")
NotImplementedError: Cannot convert transition_probs to a tensor variable.