You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems to work with both static and dynamic for scan loops, but not with while loops.
importpytensorimportpytensor.tensorasptfrompytensor.scanimportuntilx=pt.scalar("x")
n_steps=pt.iscalar("n_steps")
y, _, =pytensor.scan(
lambdaxtm1: xtm1+1, # for loop# lambda xtm1: (xtm1 + 1, {}, until(xtm1 >= 100)), # while loopoutputs_info=[x],
n_steps=n_steps, # dynamic# n_steps=100, # staticstrict=True,
)
# Save memory is triggered by choosing only last valuey=y[-1]
pytensor.config.optimizer_verbose=Truef=pytensor.function([x, n_steps], y, on_unused_input="ignore")
This can make a big difference in memory as well as performance as it avoids allocating large arrays for the outputs when these are not of interest (see #174)
The text was updated successfully, but these errors were encountered:
Description
The rewrite
save_mem_new_scan
pytensor/pytensor/scan/rewriting.py
Line 1119 in 8ad3317
Seems to work with both static and dynamic for scan loops, but not with while loops.
This can make a big difference in memory as well as performance as it avoids allocating large arrays for the outputs when these are not of interest (see #174)
The text was updated successfully, but these errors were encountered: