Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option not to print inner graphs in debug_print #1285

Open
ricardoV94 opened this issue Mar 11, 2025 · 0 comments · May be fixed by #1293
Open

Add option not to print inner graphs in debug_print #1285

ricardoV94 opened this issue Mar 11, 2025 · 0 comments · May be fixed by #1293

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Mar 11, 2025

import pytensor
import pytensor.tensor as pt
from pytensor.compile.mode import get_default_mode

n = pt.iscalar("n")
x0 = pt.vector("x0")
xs, _ = pytensor.scan(lambda xtm1: xtm1 + 1, outputs_info=[x0], n_steps=n)

mode = get_default_mode().including("scan_save_mem")
fn = pytensor.function([n, x0], xs, mode=mode, on_unused_input="ignore")
fn.dprint()
Subtensor{start:} [id A] 6
 ├─ Scan{scan_fn, while_loop=False, inplace=all} [id B] 5
 │  ├─ n [id C]
 │  └─ SetSubtensor{:stop} [id D] 4
 │     ├─ AllocEmpty{dtype='float64'} [id E] 3
 │     │  ├─ Add [id F] 2
 │     │  │  ├─ 1 [id G]
 │     │  │  └─ n [id C]
 │     │  └─ Shape_i{0} [id H] 1
 │     │     └─ x0 [id I]
 │     ├─ ExpandDims{axis=0} [id J] 0
 │     │  └─ x0 [id I]
 │     └─ 1 [id K]
 └─ 1 [id K]

Inner graphs:

Scan{scan_fn, while_loop=False, inplace=all} [id B]
 ← Add [id L]
    ├─ [1.] [id M]
    └─ *0-<Vector(float64, shape=(?,))> [id N] -> [id D]

Want to add an option debug_print(print_inner_graphs=False) that ommits the inner graphs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant