Open
Description
Description
import pytensor
import pytensor.tensor as pt
x0 = pt.vector("x0")
n = pt.iscalar("n")
outs, _ = pytensor.scan(lambda xtm1: (xtm1 + 1, xtm1), outputs_info=[x0, None], n_steps=n)
fn = pytensor.function([n, x0], outs)
fn(n=0, x0=[1, 2, 3])
# [array([], shape=(0, 3), dtype=float64),
# array([], shape=(0, 0), dtype=float64)]
Unless the nitsot have static output shape I don't think we can figure out the correct shape without evaluating the function atleast once. We should raise or add some extra logic to handle that case.
Originally Scan didn't allow 0 steps, that was relaxed in aesara-devs/aesara#741