Skip to content

local_subtensor_merge can complicate graphs #112

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

Open
aseyboldt opened this issue Dec 13, 2022 · 6 comments
Open

local_subtensor_merge can complicate graphs #112

aseyboldt opened this issue Dec 13, 2022 · 6 comments
Labels

Comments

@aseyboldt
Copy link
Member

aseyboldt commented Dec 13, 2022

Description

The local_subtensor_merge op often makes graph worse instead of better:
https://github.com/pymc-devs/pytensor/blob/main/pytensor/tensor/rewriting/subtensor.py#L475

import pytensor.tensor as pt
import pytensor

x = pt.dvector("x")
y = x[1:-1][1:-1][1:-1]

pytensor.config.optdb__max_use_ratio = 20
func = pytensor.function([x], y)

# Before rewriting:
"""
Subtensor{int64:int64:} [id A]
 |Subtensor{int64:int64:} [id B]
 | |Subtensor{int64:int64:} [id C]
 | | |x [id D]
 | | |ScalarConstant{1} [id E]
 | | |ScalarConstant{-1} [id F]
 | |ScalarConstant{1} [id G]
 | |ScalarConstant{-1} [id H]
 |ScalarConstant{1} [id I]
 |ScalarConstant{-1} [id J]
"""

After:

DeepCopyOp [id A] 27
 |Subtensor{int64:int64:int8} [id B] 26
   |x [id C]
   |ScalarFromTensor [id D] 24
   | |Elemwise{Composite{Switch(i0, 0, minimum((i1 + i2), i3))}}[(0, 2)] [id E] 22
   |   |Elemwise{Composite{LE((i0 - i1), 0)}} [id F] 21
   |   | |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0, -1), i2), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0, -1), i2))}}[(0, 0)] [id G] 19
   |   | | |Elemwise{Composite{Switch(i0, 0, minimum((i1 + i2), i3))}}[(0, 1)] [id H] 12
   |   | | | |Elemwise{Composite{LE((i0 - i1), 0)}} [id I] 10
   |   | | | | |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id J] 8
   |   | | | | | |Elemwise{sub,no_inplace} [id K] 7
   |   | | | | |   |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id L] 4
   |   | | | | |   | |Elemwise{sub,no_inplace} [id M] 3
   |   | | | | |   |   |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id N] 1
   |   | | | | |   |   | |Shape_i{0} [id O] 0
   |   | | | | |   |   |   |x [id C]
   |   | | | | |   |   |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}}[(0, 0)] [id P] 2
   |   | | | | |   |     |Shape_i{0} [id O] 0
   |   | | | | |   |     |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id N] 1
   |   | | | | |   |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}} [id Q] 6
   |   | | | | |     |Elemwise{sub,no_inplace} [id M] 3
   |   | | | | |     |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id L] 4
   |   | | | | |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}}[(0, 0)] [id R] 9
   |   | | | |   |Elemwise{sub,no_inplace} [id K] 7
   |   | | | |   |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id J] 8
   |   | | | |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}} [id Q] 6
   |   | | | |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id J] 8
   |   | | | |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id L] 4
   |   | | |TensorFromScalar [id S] 18
   |   | | | |add [id T] 16
   |   | | |   |ScalarFromTensor [id U] 14
   |   | | |   | |Elemwise{Composite{Switch(i0, 0, minimum((i1 + i2), i3))}}[(0, 1)] [id H] 12
   |   | | |   |ScalarFromTensor [id V] 5
   |   | | |     |Elemwise{sub,no_inplace} [id M] 3
   |   | | |Elemwise{sub,no_inplace} [id M] 3
   |   | |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0), i2), 0), i3), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0), i2), 0), i3)}}[(0, 0)] [id W] 20
   |   |   |Elemwise{Composite{Switch(i0, 0, minimum((i1 + i2), i3))}}[(0, 2)] [id X] 11
   |   |   | |Elemwise{Composite{LE((i0 - i1), 0)}} [id I] 10
   |   |   | |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}} [id Q] 6
   |   |   | |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}}[(0, 0)] [id R] 9
   |   |   | |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id L] 4
   |   |   |TensorFromScalar [id Y] 17
   |   |   | |add [id Z] 15
   |   |   |   |ScalarFromTensor [id BA] 13
   |   |   |   | |Elemwise{Composite{Switch(i0, 0, minimum((i1 + i2), i3))}}[(0, 2)] [id X] 11
   |   |   |   |ScalarFromTensor [id V] 5
   |   |   |Elemwise{sub,no_inplace} [id M] 3
   |   |   |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0, -1), i2), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0, -1), i2))}}[(0, 0)] [id G] 19
   |   |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}}[(0, 0)] [id P] 2
   |   |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0), i2), 0), i3), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0), i2), 0), i3)}}[(0, 0)] [id W] 20
   |   |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id N] 1
   |ScalarFromTensor [id BB] 25
   | |Elemwise{Composite{Switch(i0, 0, minimum((i1 + i2), i3))}}[(0, 1)] [id BC] 23
   |   |Elemwise{Composite{LE((i0 - i1), 0)}} [id F] 21
   |   |Elemwise{Composite{Switch(LT(Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1), Composite{Switch(LT(i0, i1), i1, i0)}(Composite{Switch(GE(i0, i1), i1, i0)}(1, i0), 0), i1)}}[(0, 0)] [id P] 2
   |   |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0, -1), i2), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}(i0, 0, i1), 0, -1), i2))}}[(0, 0)] [id G] 19
   |   |Elemwise{Composite{Switch(LT(Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0), 0), 0, Composite{Switch(GE(i0, i1), i1, i0)}(Composite{Switch(LT(i0, i1), i2, i0)}((i0 - 1), 0, -1), i0))}} [id N] 1
   |ScalarConstant{1} [id BD]

I think this rewrite might be fine in some special cases with known shapes/indices, but in general I don't see why we would do this rewrite.

@ricardoV94
Copy link
Member

Yes, it may make sense to restrict it to static indexes cases. Is this a realistic example though?

@ferrine
Copy link
Member

ferrine commented Dec 13, 2022

I agree with @aseyboldt and I see this example as realistic enough. You can use such nested indexing to represent grouped hierarchy, but not sure if it hits this particular thing.

@aseyboldt
Copy link
Member Author

A problem is that I think some scan rewrites depend on this. But I think we should probably restrict this one to static indexes or so and worry about fixing scan later.

@ricardoV94 ricardoV94 changed the title local_subtensor_merge can mess up graphs local_subtensor_merge can complicate graphs Feb 9, 2023
@ricardoV94 ricardoV94 changed the title local_subtensor_merge can complicate graphs local_subtensor_merge can complicate graphs Feb 9, 2023
@ricardoV94
Copy link
Member

ricardoV94 commented Mar 13, 2025

This gets utterly insane on gradient of scans:

from pytensor import scan, function

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

x0 = pt.scalar("x0")
n = pt.scalar("n", dtype=int)
xs, _ = scan(
    fn=lambda xtm1: xtm1 ** 2,
    outputs_info=[x0],
    n_steps=n,
)
grad_xs_wrt_x0 = pt.grad(xs[-1], x0)
fn = function([n, x0], grad_xs_wrt_x0, mode=get_mode("fast_run").including("local_subtensor_merge"))
fn.dprint(print_shape=True, print_op_info=True)

Try it with and without the rewrite.

Without
Squeeze{axis=0} [id A] shape=() 21
 └─ SpecifyShape [id B] shape=(1,) 20
    ├─ Subtensor{:stop} [id C] shape=(?,) 19
    │  ├─ Subtensor{::step} [id D] shape=(?,) 18
    │  │  ├─ Scan{grad_of_scan_fn, while_loop=False, inplace=all} [id E] shape=(?,) 17 (outer_out_mit_mot-0)
    │  │  │  ├─ n [id F] shape=() (n_steps)
    │  │  │  ├─ Subtensor{:stop} [id G] shape=(?,) 16 (outer_in_seqs-0)
    │  │  │  │  ├─ Subtensor{::step} [id H] shape=(?,) 15
    │  │  │  │  │  ├─ Subtensor{:stop} [id I] shape=(?,) 14
    │  │  │  │  │  │  ├─ Scan{scan_fn, while_loop=False, inplace=all} [id J] shape=(?,) 12 (outer_out_sit_sot-0)
    │  │  │  │  │  │  │  ├─ Composite{...}.2 [id K] shape=() 1 (n_steps)
    │  │  │  │  │  │  │  │  └─ n [id F] shape=()
    │  │  │  │  │  │  │  └─ SetSubtensor{:stop} [id L] shape=(?,) 10 (outer_in_sit_sot-0)
    │  │  │  │  │  │  │     ├─ AllocEmpty{dtype='float64'} [id M] shape=(?,) 7
    │  │  │  │  │  │  │     │  └─ Composite{...}.3 [id K] shape=() 1
    │  │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │  │     ├─ Unbroadcast{0} [id N] shape=(?,) 8
    │  │  │  │  │  │  │     │  └─ ExpandDims{axis=0} [id O] shape=(1,) 3
    │  │  │  │  │  │  │     │     └─ x0 [id P] shape=()
    │  │  │  │  │  │  │     └─ 1 [id Q] shape=()
    │  │  │  │  │  │  └─ ScalarFromTensor [id R] shape=() 6
    │  │  │  │  │  │     └─ Composite{...}.1 [id K] shape=() 1
    │  │  │  │  │  │        └─ ···
    │  │  │  │  │  └─ -1 [id S] shape=()
    │  │  │  │  └─ ScalarFromTensor [id T] shape=() 2
    │  │  │  │     └─ n [id F] shape=()
    │  │  │  └─ Subtensor{::step} [id U] shape=(?,) 13 (outer_in_mit_mot-0)
    │  │  │     ├─ IncSubtensor{start:} [id V] shape=(?,) 11
    │  │  │     │  ├─ Alloc [id W] shape=(?,) 5
    │  │  │     │  │  ├─ [0.] [id X] shape=(1,)
    │  │  │     │  │  └─ Composite{...}.0 [id K] shape=() 1
    │  │  │     │  │     └─ ···
    │  │  │     │  ├─ IncSubtensor{i} [id Y] shape=(?,) 9
    │  │  │     │  │  ├─ Alloc [id Z] shape=(?,) 4
    │  │  │     │  │  │  ├─ [0.] [id X] shape=(1,)
    │  │  │     │  │  │  └─ Composite{((i0 + 1) - switch(lt(1, (i0 + 1)), 1, (i0 + 1)))} [id BA] shape=() 0
    │  │  │     │  │  │     └─ n [id F] shape=()
    │  │  │     │  │  ├─ 1.0 [id BB] shape=()
    │  │  │     │  │  └─ -1 [id S] shape=()
    │  │  │     │  └─ 1 [id Q] shape=()
    │  │  │     └─ -1 [id S] shape=()
    │  │  └─ -1 [id S] shape=()
    │  └─ 1 [id Q] shape=()
    └─ 1 [id BC] shape=()

Inner graphs:
Scan{grad_of_scan_fn, while_loop=False, inplace=all} [id E]
 ← Composite{((2.0 * i0 * i1) + i2)} [id BD] shape=() (inner_out_mit_mot-0-0)
    ├─ *1-<Scalar(float64, shape=())> [id BE] shape=() -> [id U] (inner_in_mit_mot-0-0)
    ├─ *0-<Scalar(float64, shape=())> [id BF] shape=() -> [id G] (inner_in_seqs-0)
    └─ *2-<Scalar(float64, shape=())> [id BG] shape=() -> [id U] (inner_in_mit_mot-0-1)
Scan{scan_fn, while_loop=False, inplace=all} [id J]
 ← Sqr [id BH] shape=() (inner_out_sit_sot-0)
    └─ *0-<Scalar(float64, shape=())> [id BF] shape=() -> [id L] (inner_in_sit_sot-0)
Composite{...} [id K]
 ← add [id BI] shape=() 'o0'
    ├─ 1 [id BJ] shape=()
    └─ i0 [id BK] shape=()
 ← Switch [id BL] shape=() 'o1'
    ├─ LT [id BM] shape=()
    │  ├─ add [id BN] shape=() 't11'
    │  │  ├─ -1 [id BO] shape=()
    │  │  └─ add [id BI] shape=() 'o0'
    │  │     └─ ···
    │  └─ 0 [id BP] shape=()
    ├─ 0 [id BP] shape=()
    └─ add [id BN] shape=() 't11'
       └─ ···
 ← maximum [id BQ] shape=() 'o2'
    ├─ minimum [id BR] shape=()
    │  ├─ sub [id BS] shape=()
    │  │  ├─ Switch [id BL] shape=() 'o1'
    │  │  │  └─ ···
    │  │  └─ 1 [id BT] shape=()
    │  └─ i0 [id BK] shape=()
    └─ 1 [id BT] shape=()
 ← add [id BU] shape=() 'o3'
    ├─ maximum [id BQ] shape=() 'o2'
    │  └─ ···
    └─ 1 [id BJ] shape=()
Composite{((i0 + 1) - switch(lt(1, (i0 + 1)), 1, (i0 + 1)))} [id BA]
 ← sub [id BV] shape=() 'o0'
    ├─ add [id BW] shape=() 't0'
    │  ├─ i0 [id BX] shape=()
    │  └─ 1 [id BY] shape=()
    └─ Switch [id BZ] shape=()
       ├─ LT [id CA] shape=()
       │  ├─ 1 [id BY] shape=()
       │  └─ add [id BW] shape=() 't0'
       │     └─ ···
       ├─ 1 [id BY] shape=()
       └─ add [id BW] shape=() 't0'
          └─ ···
Composite{((2.0 * i0 * i1) + i2)} [id BD]
 ← add [id CB] shape=() 'o0'
    ├─ mul [id CC] shape=()
    │  ├─ 2.0 [id CD] shape=()
    │  ├─ i0 [id CE] shape=()
    │  └─ i1 [id CF] shape=()
    └─ i2 [id CG] shape=()
With
Squeeze{axis=0} [id A] shape=() 65
 └─ SpecifyShape [id B] shape=(1,) 64
    ├─ Subtensor{start:stop:step} [id C] shape=(?,) 63
    │  ├─ Scan{grad_of_scan_fn, while_loop=False, inplace=all} [id D] shape=(?,) 62 (outer_out_mit_mot-0)
    │  │  ├─ Composite{...}.6 [id E] shape=() 22 (n_steps)
    │  │  │  ├─ Composite{...}.9 [id F] shape=() 0
    │  │  │  │  └─ n [id G] shape=()
    │  │  │  ├─ TensorFromScalar [id H] shape=() 19
    │  │  │  │  └─ add [id I] shape=() 15
    │  │  │  │     ├─ ScalarFromTensor [id J] shape=() 7
    │  │  │  │     │  └─ Composite{...}.8 [id F] shape=() 0
    │  │  │  │     │     └─ ···
    │  │  │  │     └─ ScalarFromTensor [id K] shape=() 5
    │  │  │  │        └─ Composite{...}.3 [id F] shape=() 0
    │  │  │  │           └─ ···
    │  │  │  ├─ Composite{...}.8 [id F] shape=() 0
    │  │  │  │  └─ ···
    │  │  │  ├─ Composite{...}.3 [id F] shape=() 0
    │  │  │  │  └─ ···
    │  │  │  ├─ Composite{...}.4 [id F] shape=() 0
    │  │  │  │  └─ ···
    │  │  │  ├─ Composite{...}.7 [id F] shape=() 0
    │  │  │  │  └─ ···
    │  │  │  ├─ TensorFromScalar [id L] shape=() 18
    │  │  │  │  └─ add [id M] shape=() 14
    │  │  │  │     ├─ ScalarFromTensor [id N] shape=() 6
    │  │  │  │     │  └─ Composite{...}.5 [id F] shape=() 0
    │  │  │  │     │     └─ ···
    │  │  │  │     └─ ScalarFromTensor [id K] shape=() 5
    │  │  │  │        └─ ···
    │  │  │  ├─ Composite{...}.5 [id F] shape=() 0
    │  │  │  │  └─ ···
    │  │  │  └─ n [id G] shape=()
    │  │  ├─ Subtensor{start:stop:step} [id O] shape=(?,) 61 (outer_in_seqs-0)
    │  │  │  ├─ Scan{scan_fn, while_loop=False, inplace=all} [id P] shape=(?,) 55 (outer_out_sit_sot-0)
    │  │  │  │  ├─ Composite{...}.0 [id Q] shape=() 47 (n_steps)
    │  │  │  │  │  ├─ Composite{...}.2 [id R] shape=() 38
    │  │  │  │  │  │  ├─ Composite{...}.1 [id S] shape=() 24
    │  │  │  │  │  │  │  ├─ TensorFromScalar [id T] shape=() 21
    │  │  │  │  │  │  │  │  └─ add [id U] shape=() 17
    │  │  │  │  │  │  │  │     ├─ ScalarFromTensor [id V] shape=() 3
    │  │  │  │  │  │  │  │     │  └─ n [id G] shape=()
    │  │  │  │  │  │  │  │     └─ ScalarFromTensor [id W] shape=() 11
    │  │  │  │  │  │  │  │        └─ Composite{...}.0 [id X] shape=() 2
    │  │  │  │  │  │  │  │           └─ n [id G] shape=()
    │  │  │  │  │  │  │  ├─ Composite{...}.2 [id X] shape=() 2
    │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  ├─ Composite{...}.1 [id X] shape=() 2
    │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  ├─ Composite{...}.5 [id X] shape=() 2
    │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  ├─ Composite{...}.7 [id X] shape=() 2
    │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  ├─ Composite{...}.6 [id X] shape=() 2
    │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  └─ Composite{...}.8 [id X] shape=() 2
    │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  ├─ TensorFromScalar [id Y] shape=() 36
    │  │  │  │  │  │  │  └─ add [id Z] shape=() 32
    │  │  │  │  │  │  │     ├─ ScalarFromTensor [id BA] shape=() 28
    │  │  │  │  │  │  │     │  └─ Composite{...}.0 [id S] shape=() 24
    │  │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │  │     └─ ScalarFromTensor [id BB] shape=() 12
    │  │  │  │  │  │  │        └─ Composite{...}.3 [id X] shape=() 2
    │  │  │  │  │  │  │           └─ ···
    │  │  │  │  │  │  ├─ Composite{...}.0 [id S] shape=() 24
    │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  ├─ Composite{...}.3 [id X] shape=() 2
    │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  ├─ Composite{...}.4 [id X] shape=() 2
    │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  ├─ Composite{...}.3 [id S] shape=() 24
    │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  ├─ TensorFromScalar [id BC] shape=() 35
    │  │  │  │  │  │  │  └─ add [id BD] shape=() 31
    │  │  │  │  │  │  │     ├─ ScalarFromTensor [id BE] shape=() 27
    │  │  │  │  │  │  │     │  └─ Composite{...}.2 [id S] shape=() 24
    │  │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │  │     └─ ScalarFromTensor [id BB] shape=() 12
    │  │  │  │  │  │  │        └─ ···
    │  │  │  │  │  │  ├─ Composite{...}.2 [id S] shape=() 24
    │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  └─ Composite{...}.9 [id X] shape=() 2
    │  │  │  │  │  │     └─ ···
    │  │  │  │  │  ├─ TensorFromScalar [id BF] shape=() 46
    │  │  │  │  │  │  └─ add [id BG] shape=() 44
    │  │  │  │  │  │     ├─ ScalarFromTensor [id BH] shape=() 42
    │  │  │  │  │  │     │  └─ Composite{...}.0 [id R] shape=() 38
    │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │     └─ ScalarFromTensor [id BI] shape=() 9
    │  │  │  │  │  │        └─ Composite{...}.0 [id F] shape=() 0
    │  │  │  │  │  │           └─ ···
    │  │  │  │  │  ├─ Composite{...}.0 [id R] shape=() 38
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ Composite{...}.0 [id F] shape=() 0
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ Composite{...}.1 [id F] shape=() 0
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ Composite{...}.3 [id R] shape=() 38
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ TensorFromScalar [id BJ] shape=() 45
    │  │  │  │  │  │  └─ add [id BK] shape=() 43
    │  │  │  │  │  │     ├─ ScalarFromTensor [id BL] shape=() 41
    │  │  │  │  │  │     │  └─ Composite{...}.1 [id R] shape=() 38
    │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │     └─ ScalarFromTensor [id BI] shape=() 9
    │  │  │  │  │  │        └─ ···
    │  │  │  │  │  ├─ Composite{...}.1 [id R] shape=() 38
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ n [id G] shape=()
    │  │  │  │  │  ├─ Composite{...}.2 [id F] shape=() 0
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ Composite{...}.4 [id R] shape=() 38
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ TensorFromScalar [id BF] shape=() 46
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  ├─ Composite{...}.5 [id R] shape=() 38
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  └─ TensorFromScalar [id BJ] shape=() 45
    │  │  │  │  │     └─ ···
    │  │  │  │  └─ SetSubtensor{:stop} [id BM] shape=(?,) 52 (outer_in_sit_sot-0)
    │  │  │  │     ├─ AllocEmpty{dtype='float64'} [id BN] shape=(?,) 49
    │  │  │  │     │  └─ Composite{...}.7 [id Q] shape=() 47
    │  │  │  │     │     └─ ···
    │  │  │  │     ├─ Unbroadcast{0} [id BO] shape=(?,) 13
    │  │  │  │     │  └─ ExpandDims{axis=0} [id BP] shape=(1,) 4
    │  │  │  │     │     └─ x0 [id BQ] shape=()
    │  │  │  │     └─ 1 [id BR] shape=()
    │  │  │  ├─ ScalarFromTensor [id BS] shape=() 60
    │  │  │  │  └─ Composite{...}.1 [id BT] shape=() 58
    │  │  │  │     ├─ Composite{...}.3 [id Q] shape=() 47
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ TensorFromScalar [id BU] shape=() 57
    │  │  │  │     │  └─ add [id BV] shape=() 54
    │  │  │  │     │     ├─ ScalarFromTensor [id BW] shape=() 51
    │  │  │  │     │     │  └─ Composite{...}.1 [id Q] shape=() 47
    │  │  │  │     │     │     └─ ···
    │  │  │  │     │     └─ ScalarFromTensor [id BX] shape=() 48
    │  │  │  │     │        └─ Composite{...}.7 [id Q] shape=() 47
    │  │  │  │     │           └─ ···
    │  │  │  │     ├─ Composite{...}.1 [id Q] shape=() 47
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ Composite{...}.7 [id Q] shape=() 47
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ Composite{...}.6 [id Q] shape=() 47
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ TensorFromScalar [id BY] shape=() 56
    │  │  │  │     │  └─ add [id BZ] shape=() 53
    │  │  │  │     │     ├─ ScalarFromTensor [id CA] shape=() 50
    │  │  │  │     │     │  └─ Composite{...}.2 [id Q] shape=() 47
    │  │  │  │     │     │     └─ ···
    │  │  │  │     │     └─ ScalarFromTensor [id BX] shape=() 48
    │  │  │  │     │        └─ ···
    │  │  │  │     ├─ Composite{...}.2 [id Q] shape=() 47
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ Composite{...}.5 [id Q] shape=() 47
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ TensorFromScalar [id BU] shape=() 57
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ Composite{...}.4 [id Q] shape=() 47
    │  │  │  │     │  └─ ···
    │  │  │  │     ├─ TensorFromScalar [id BY] shape=() 56
    │  │  │  │     │  └─ ···
    │  │  │  │     └─ Composite{...}.8 [id Q] shape=() 47
    │  │  │  │        └─ ···
    │  │  │  ├─ ScalarFromTensor [id CB] shape=() 59
    │  │  │  │  └─ Composite{...}.0 [id BT] shape=() 58
    │  │  │  │     └─ ···
    │  │  │  └─ -1 [id CC] shape=()
    │  │  └─ Subtensor{::step} [id CD] shape=(?,) 23 (outer_in_mit_mot-0)
    │  │     ├─ IncSubtensor{start:} [id CE] shape=(?,) 20
    │  │     │  ├─ Alloc [id CF] shape=(?,) 8
    │  │     │  │  ├─ [0.] [id CG] shape=(1,)
    │  │     │  │  └─ Composite{...}.0 [id F] shape=() 0
    │  │     │  │     └─ ···
    │  │     │  ├─ IncSubtensor{i} [id CH] shape=(?,) 16
    │  │     │  │  ├─ Alloc [id CI] shape=(?,) 10
    │  │     │  │  │  ├─ [0.] [id CG] shape=(1,)
    │  │     │  │  │  └─ Composite{((i0 + 1) - switch(lt(1, (i0 + 1)), 1, (i0 + 1)))} [id CJ] shape=() 1
    │  │     │  │  │     └─ n [id G] shape=()
    │  │     │  │  ├─ 1.0 [id CK] shape=()
    │  │     │  │  └─ -1 [id CC] shape=()
    │  │     │  └─ 1 [id BR] shape=()
    │  │     └─ -1 [id CC] shape=()
    │  ├─ ScalarFromTensor [id CL] shape=() 40
    │  │  └─ Composite{...}.1 [id CM] shape=() 37
    │  │     ├─ Composite{...}.1 [id E] shape=() 22
    │  │     │  └─ ···
    │  │     ├─ TensorFromScalar [id CN] shape=() 34
    │  │     │  └─ add [id CO] shape=() 30
    │  │     │     ├─ ScalarFromTensor [id CP] shape=() 26
    │  │     │     │  └─ Composite{...}.0 [id E] shape=() 22
    │  │     │     │     └─ ···
    │  │     │     └─ ScalarFromTensor [id K] shape=() 5
    │  │     │        └─ ···
    │  │     ├─ Composite{...}.0 [id E] shape=() 22
    │  │     │  └─ ···
    │  │     ├─ Composite{...}.3 [id F] shape=() 0
    │  │     │  └─ ···
    │  │     ├─ Composite{...}.5 [id E] shape=() 22
    │  │     │  └─ ···
    │  │     ├─ TensorFromScalar [id CQ] shape=() 33
    │  │     │  └─ add [id CR] shape=() 29
    │  │     │     ├─ ScalarFromTensor [id CS] shape=() 25
    │  │     │     │  └─ Composite{...}.3 [id E] shape=() 22
    │  │     │     │     └─ ···
    │  │     │     └─ ScalarFromTensor [id K] shape=() 5
    │  │     │        └─ ···
    │  │     ├─ Composite{...}.3 [id E] shape=() 22
    │  │     │  └─ ···
    │  │     ├─ Composite{...}.2 [id E] shape=() 22
    │  │     │  └─ ···
    │  │     ├─ TensorFromScalar [id CN] shape=() 34
    │  │     │  └─ ···
    │  │     ├─ Composite{...}.4 [id E] shape=() 22
    │  │     │  └─ ···
    │  │     ├─ TensorFromScalar [id CQ] shape=() 33
    │  │     │  └─ ···
    │  │     └─ Composite{...}.6 [id F] shape=() 0
    │  │        └─ ···
    │  ├─ ScalarFromTensor [id CT] shape=() 39
    │  │  └─ Composite{...}.0 [id CM] shape=() 37
    │  │     └─ ···
    │  └─ -1 [id CC] shape=()
    └─ 1 [id CU] shape=()

Inner graphs:
Scan{grad_of_scan_fn, while_loop=False, inplace=all} [id D]
 ← Composite{((2.0 * i0 * i1) + i2)} [id CV] shape=() (inner_out_mit_mot-0-0)
    ├─ *1-<Scalar(float64, shape=())> [id CW] shape=() -> [id CD] (inner_in_mit_mot-0-0)
    ├─ *0-<Scalar(float64, shape=())> [id CX] shape=() -> [id O] (inner_in_seqs-0)
    └─ *2-<Scalar(float64, shape=())> [id CY] shape=() -> [id CD] (inner_in_mit_mot-0-1)
Composite{...} [id E]
 ← Switch [id CZ] shape=() 'o0'
    ├─ LT [id DA] shape=()
    │  ├─ add [id DB] shape=() 't15'
    │  │  ├─ Switch [id DC] shape=() 't31'
    │  │  │  ├─ GE [id DD] shape=()
    │  │  │  │  ├─ Switch [id DE] shape=() 't9'
    │  │  │  │  │  ├─ LT [id DF] shape=()
    │  │  │  │  │  │  ├─ Switch [id DG] shape=() 't3'
    │  │  │  │  │  │  │  ├─ i0 [id DH] shape=()
    │  │  │  │  │  │  │  ├─ i1 [id DI] shape=()
    │  │  │  │  │  │  │  └─ i2 [id DJ] shape=()
    │  │  │  │  │  │  └─ 0 [id DK] shape=()
    │  │  │  │  │  ├─ -1 [id DL] shape=()
    │  │  │  │  │  └─ Switch [id DG] shape=() 't3'
    │  │  │  │  │     └─ ···
    │  │  │  │  └─ i3 [id DM] shape=()
    │  │  │  ├─ i4 [id DN] shape=()
    │  │  │  └─ Switch [id DE] shape=() 't9'
    │  │  │     └─ ···
    │  │  └─ 1 [id DO] shape=()
    │  └─ 0 [id DK] shape=()
    ├─ 0 [id DK] shape=()
    └─ add [id DB] shape=() 't15'
       └─ ···
 ← LT [id DP] shape=() 'o1'
    ├─ Switch [id CZ] shape=() 'o0'
    │  └─ ···
    └─ 0 [id DK] shape=()
 ← LT [id DQ] shape=() 'o2'
    ├─ Switch [id CZ] shape=() 'o0'
    │  └─ ···
    └─ 0 [id DK] shape=()
 ← Switch [id DR] shape=() 'o3'
    ├─ LT [id DS] shape=()
    │  ├─ Switch [id DT] shape=() 't42'
    │  │  ├─ LT [id DU] shape=()
    │  │  │  ├─ Switch [id DV] shape=() 't10'
    │  │  │  │  ├─ LT [id DW] shape=()
    │  │  │  │  │  ├─ sub [id DX] shape=() 't11'
    │  │  │  │  │  │  ├─ sub [id DY] shape=()
    │  │  │  │  │  │  │  ├─ add [id DB] shape=() 't15'
    │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  └─ sub [id DZ] shape=()
    │  │  │  │  │  │  │     ├─ Switch [id EA] shape=()
    │  │  │  │  │  │  │     │  ├─ LT [id EB] shape=()
    │  │  │  │  │  │  │     │  │  ├─ add [id EC] shape=() 't32'
    │  │  │  │  │  │  │     │  │  │  ├─ int_div [id ED] shape=()
    │  │  │  │  │  │  │     │  │  │  │  ├─ sub [id EE] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  ├─ sub [id EF] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ Switch [id DC] shape=() 't31'
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │     │  │  │  │  │  │  └─ Switch [id EG] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     ├─ GE [id EH] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  ├─ Switch [id EI] shape=() 't34'
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  ├─ LT [id EJ] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  ├─ Switch [id EK] shape=() 't45'
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  ├─ i5 [id EL] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  ├─ i6 [id EM] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  └─ i7 [id EN] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  └─ 0 [id DK] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  ├─ -1 [id DL] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  └─ Switch [id EK] shape=() 't45'
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  │     └─ ···
    │  │  │  │  │  │  │     │  │  │  │  │  │     │  └─ i3 [id DM] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     ├─ i3 [id DM] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │     └─ Switch [id EI] shape=() 't34'
    │  │  │  │  │  │  │     │  │  │  │  │  │        └─ ···
    │  │  │  │  │  │  │     │  │  │  │  │  └─ 1 [id DO] shape=()
    │  │  │  │  │  │  │     │  │  │  │  └─ 1 [id EO] shape=()
    │  │  │  │  │  │  │     │  │  │  └─ 1 [id DO] shape=()
    │  │  │  │  │  │  │     │  │  └─ 0 [id DK] shape=()
    │  │  │  │  │  │  │     │  ├─ 0 [id DK] shape=()
    │  │  │  │  │  │  │     │  └─ add [id EC] shape=() 't32'
    │  │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │  │     └─ 1 [id DO] shape=()
    │  │  │  │  │  │  └─ 1 [id DO] shape=()
    │  │  │  │  │  └─ 0 [id DK] shape=()
    │  │  │  │  ├─ sub [id EP] shape=()
    │  │  │  │  │  ├─ add [id DB] shape=() 't15'
    │  │  │  │  │  │  └─ ···
    │  │  │  │  │  └─ 1 [id DO] shape=()
    │  │  │  │  └─ sub [id DX] shape=() 't11'
    │  │  │  │     └─ ···
    │  │  │  └─ 0 [id DK] shape=()
    │  │  ├─ 0 [id DK] shape=()
    │  │  └─ Switch [id DV] shape=() 't10'
    │  │     └─ ···
    │  └─ Switch [id CZ] shape=() 'o0'
    │     └─ ···
    ├─ Switch [id DT] shape=() 't42'
    │  └─ ···
    └─ Switch [id CZ] shape=() 'o0'
       └─ ···
 ← LT [id EQ] shape=() 'o4'
    ├─ Switch [id DR] shape=() 'o3'
    │  └─ ···
    └─ 0 [id DK] shape=()
 ← LT [id ER] shape=() 'o5'
    ├─ Switch [id DR] shape=() 'o3'
    │  └─ ···
    └─ 0 [id DK] shape=()
 ← maximum [id ES] shape=() 'o6'
    ├─ minimum [id ET] shape=()
    │  ├─ sub [id EU] shape=()
    │  │  ├─ Switch [id CZ] shape=() 'o0'
    │  │  │  └─ ···
    │  │  └─ 0 [id DK] shape=()
    │  └─ i8 [id EV] shape=()
    └─ 1 [id DO] shape=()
Composite{...} [id F]
 ← add [id EW] shape=() 'o0'
    ├─ 1 [id EX] shape=()
    └─ i0 [id EY] shape=()
 ← sub [id EZ] shape=() 'o1'
    ├─ add [id EW] shape=() 'o0'
    │  └─ ···
    └─ 1 [id FA] shape=()
 ← sub [id FB] shape=() 'o2'
    ├─ add [id EW] shape=() 'o0'
    │  └─ ···
    └─ 1 [id FA] shape=()
 ← sub [id FC] shape=() 'o3'
    ├─ Switch [id FD] shape=() 't37'
    │  ├─ LT [id FE] shape=()
    │  │  ├─ add [id EW] shape=() 'o0'
    │  │  │  └─ ···
    │  │  └─ 0 [id FF] shape=()
    │  ├─ 0 [id FF] shape=()
    │  └─ add [id EW] shape=() 'o0'
    │     └─ ···
    └─ Switch [id FG] shape=() 't35'
       ├─ LT [id FH] shape=()
       │  ├─ Switch [id FI] shape=() 't20'
       │  │  ├─ LT [id FJ] shape=()
       │  │  │  ├─ Switch [id FK] shape=() 't8'
       │  │  │  │  ├─ LT [id FL] shape=()
       │  │  │  │  │  ├─ sub [id FM] shape=() 't44'
       │  │  │  │  │  │  ├─ add [id EW] shape=() 'o0'
       │  │  │  │  │  │  │  └─ ···
       │  │  │  │  │  │  └─ Switch [id FD] shape=() 't37'
       │  │  │  │  │  │     └─ ···
       │  │  │  │  │  └─ 0 [id FF] shape=()
       │  │  │  │  ├─ i0 [id EY] shape=()
       │  │  │  │  └─ sub [id FM] shape=() 't44'
       │  │  │  │     └─ ···
       │  │  │  └─ 0 [id FF] shape=()
       │  │  ├─ 0 [id FF] shape=()
       │  │  └─ Switch [id FK] shape=() 't8'
       │  │     └─ ···
       │  └─ Switch [id FD] shape=() 't37'
       │     └─ ···
       ├─ Switch [id FI] shape=() 't20'
       │  └─ ···
       └─ Switch [id FD] shape=() 't37'
          └─ ···
 ← sub [id FN] shape=() 'o4'
    ├─ sub [id FC] shape=() 'o3'
    │  └─ ···
    └─ 1 [id FA] shape=()
 ← Switch [id FO] shape=() 'o5'
    ├─ LE [id FP] shape=() 't41'
    │  ├─ Switch [id FQ] shape=() 't13'
    │  │  ├─ LT [id FR] shape=()
    │  │  │  ├─ 1 [id EX] shape=()
    │  │  │  └─ sub [id FS] shape=() 't50'
    │  │  │     ├─ Switch [id FT] shape=() 't19'
    │  │  │     │  ├─ LT [id FU] shape=()
    │  │  │     │  │  ├─ sub [id FC] shape=() 'o3'
    │  │  │     │  │  │  └─ ···
    │  │  │     │  │  └─ 0 [id FF] shape=()
    │  │  │     │  ├─ 0 [id FF] shape=()
    │  │  │     │  └─ sub [id FC] shape=() 'o3'
    │  │  │     │     └─ ···
    │  │  │     └─ Switch [id FV] shape=() 't43'
    │  │  │        ├─ LT [id FW] shape=()
    │  │  │        │  ├─ Switch [id FX] shape=() 't28'
    │  │  │        │  │  ├─ LT [id FY] shape=()
    │  │  │        │  │  │  ├─ Switch [id FZ] shape=() 't49'
    │  │  │        │  │  │  │  ├─ LT [id GA] shape=()
    │  │  │        │  │  │  │  │  ├─ sub [id GB] shape=() 't25'
    │  │  │        │  │  │  │  │  │  ├─ Switch [id FD] shape=() 't37'
    │  │  │        │  │  │  │  │  │  │  └─ ···
    │  │  │        │  │  │  │  │  │  └─ add [id GC] shape=()
    │  │  │        │  │  │  │  │  │     ├─ Switch [id FG] shape=() 't35'
    │  │  │        │  │  │  │  │  │     │  └─ ···
    │  │  │        │  │  │  │  │  │     └─ Switch [id FT] shape=() 't19'
    │  │  │        │  │  │  │  │  │        └─ ···
    │  │  │        │  │  │  │  │  └─ 0 [id FF] shape=()
    │  │  │        │  │  │  │  ├─ sub [id GD] shape=()
    │  │  │        │  │  │  │  │  ├─ add [id GE] shape=()
    │  │  │        │  │  │  │  │  │  ├─ -1 [id GF] shape=()
    │  │  │        │  │  │  │  │  │  └─ Switch [id FD] shape=() 't37'
    │  │  │        │  │  │  │  │  │     └─ ···
    │  │  │        │  │  │  │  │  └─ Switch [id FG] shape=() 't35'
    │  │  │        │  │  │  │  │     └─ ···
    │  │  │        │  │  │  │  └─ sub [id GB] shape=() 't25'
    │  │  │        │  │  │  │     └─ ···
    │  │  │        │  │  │  └─ 0 [id FF] shape=()
    │  │  │        │  │  ├─ 0 [id FF] shape=()
    │  │  │        │  │  └─ Switch [id FZ] shape=() 't49'
    │  │  │        │  │     └─ ···
    │  │  │        │  └─ Switch [id FT] shape=() 't19'
    │  │  │        │     └─ ···
    │  │  │        ├─ Switch [id FX] shape=() 't28'
    │  │  │        │  └─ ···
    │  │  │        └─ Switch [id FT] shape=() 't19'
    │  │  │           └─ ···
    │  │  ├─ 1 [id EX] shape=()
    │  │  └─ sub [id FS] shape=() 't50'
    │  │     └─ ···
    │  └─ 0 [id FF] shape=()
    ├─ 0 [id FF] shape=()
    └─ Switch [id GG] shape=()
       ├─ AND [id GH] shape=()
       │  ├─ LT [id GI] shape=()
       │  │  ├─ sub [id GJ] shape=() 't26'
       │  │  │  ├─ add [id GK] shape=() 't18'
       │  │  │  │  ├─ -1 [id GF] shape=()
       │  │  │  │  └─ Switch [id FT] shape=() 't19'
       │  │  │  │     └─ ···
       │  │  │  └─ Switch [id FQ] shape=() 't13'
       │  │  │     └─ ···
       │  │  └─ 0 [id FF] shape=()
       │  └─ GT [id GL] shape=()
       │     ├─ Switch [id FQ] shape=() 't13'
       │     │  └─ ···
       │     └─ 0 [id FF] shape=()
       ├─ sub [id GM] shape=()
       │  ├─ add [id GN] shape=()
       │  │  ├─ -1 [id GF] shape=()
       │  │  └─ Switch [id FG] shape=() 't35'
       │  │     └─ ···
       │  └─ Switch [id FD] shape=() 't37'
       │     └─ ···
       └─ maximum [id GO] shape=()
          ├─ add [id GP] shape=()
          │  ├─ -1 [id GF] shape=()
          │  └─ Switch [id FV] shape=() 't43'
          │     └─ ···
          └─ sub [id GJ] shape=() 't26'
             └─ ···
 ← sub [id GQ] shape=() 'o6'
    ├─ neg [id GR] shape=()
    │  └─ sub [id FC] shape=() 'o3'
    │     └─ ···
    └─ 1 [id FA] shape=()
 ← LT [id GS] shape=() 'o7'
    ├─ Switch [id FO] shape=() 'o5'
    │  └─ ···
    └─ 0 [id FF] shape=()
 ← Switch [id GT] shape=() 'o8'
    ├─ LE [id FP] shape=() 't41'
    │  └─ ···
    ├─ 0 [id FF] shape=()
    └─ maximum [id GU] shape=()
       ├─ Switch [id FV] shape=() 't43'
       │  └─ ···
       └─ add [id GK] shape=() 't18'
          └─ ···
 ← LT [id GV] shape=() 'o9'
    ├─ Switch [id GT] shape=() 'o8'
    │  └─ ···
    └─ 0 [id FF] shape=()
Scan{scan_fn, while_loop=False, inplace=all} [id P]
 ← Sqr [id GW] shape=() (inner_out_sit_sot-0)
    └─ *0-<Scalar(float64, shape=())> [id CX] shape=() -> [id BM] (inner_in_sit_sot-0)
Composite{...} [id Q]
 ← maximum [id GX] shape=() 'o0'
    ├─ minimum [id GY] shape=()
    │  ├─ sub [id GZ] shape=()
    │  │  ├─ Switch [id HA] shape=() 't15'
    │  │  │  ├─ LT [id HB] shape=()
    │  │  │  │  ├─ add [id HC] shape=() 't8'
    │  │  │  │  │  ├─ Switch [id HD] shape=() 't5'
    │  │  │  │  │  │  ├─ GE [id HE] shape=()
    │  │  │  │  │  │  │  ├─ Switch [id HF] shape=() 't10'
    │  │  │  │  │  │  │  │  ├─ LT [id HG] shape=()
    │  │  │  │  │  │  │  │  │  ├─ Switch [id HH] shape=() 't45'
    │  │  │  │  │  │  │  │  │  │  ├─ i10 [id HI] shape=()
    │  │  │  │  │  │  │  │  │  │  ├─ i11 [id HJ] shape=()
    │  │  │  │  │  │  │  │  │  │  └─ i2 [id HK] shape=()
    │  │  │  │  │  │  │  │  │  └─ 0 [id HL] shape=()
    │  │  │  │  │  │  │  │  ├─ -1 [id HM] shape=()
    │  │  │  │  │  │  │  │  └─ Switch [id HH] shape=() 't45'
    │  │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │  └─ i3 [id HN] shape=()
    │  │  │  │  │  │  ├─ i9 [id HO] shape=()
    │  │  │  │  │  │  └─ Switch [id HF] shape=() 't10'
    │  │  │  │  │  │     └─ ···
    │  │  │  │  │  └─ 1 [id HP] shape=()
    │  │  │  │  └─ 0 [id HL] shape=()
    │  │  │  ├─ 0 [id HL] shape=()
    │  │  │  └─ add [id HC] shape=() 't8'
    │  │  │     └─ ···
    │  │  └─ 1 [id HP] shape=()
    │  └─ i8 [id HQ] shape=()
    └─ 1 [id HP] shape=()
 ← add [id HR] shape=() 'o1'
    ├─ sub [id HS] shape=()
    │  ├─ sub [id HT] shape=()
    │  │  ├─ Switch [id HA] shape=() 't15'
    │  │  │  └─ ···
    │  │  └─ maximum [id GX] shape=() 'o0'
    │  │     └─ ···
    │  └─ 1 [id HP] shape=()
    └─ maximum [id HU] shape=() 't37'
       ├─ add [id HV] shape=()
       │  ├─ sub [id HW] shape=()
       │  │  ├─ maximum [id GX] shape=() 'o0'
       │  │  │  └─ ···
       │  │  └─ Switch [id HX] shape=()
       │  │     ├─ LT [id HY] shape=()
       │  │     │  ├─ Switch [id HZ] shape=() 't20'
       │  │     │  │  ├─ LT [id IA] shape=()
       │  │     │  │  │  ├─ Switch [id IB] shape=() 't14'
       │  │     │  │  │  │  ├─ LT [id IC] shape=()
       │  │     │  │  │  │  │  ├─ sub [id ID] shape=() 't4'
       │  │     │  │  │  │  │  │  ├─ sub [id IE] shape=()
       │  │     │  │  │  │  │  │  │  ├─ add [id IF] shape=() 't44'
       │  │     │  │  │  │  │  │  │  │  ├─ Switch [id IG] shape=() 't41'
       │  │     │  │  │  │  │  │  │  │  │  ├─ GE [id IH] shape=()
       │  │     │  │  │  │  │  │  │  │  │  │  ├─ Switch [id II] shape=() 't35'
       │  │     │  │  │  │  │  │  │  │  │  │  │  ├─ LT [id IJ] shape=()
       │  │     │  │  │  │  │  │  │  │  │  │  │  │  ├─ Switch [id IK] shape=() 't29'
       │  │     │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ i0 [id IL] shape=()
       │  │     │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ i1 [id IM] shape=()
       │  │     │  │  │  │  │  │  │  │  │  │  │  │  │  └─ i2 [id HK] shape=()
       │  │     │  │  │  │  │  │  │  │  │  │  │  │  └─ 0 [id HL] shape=()
       │  │     │  │  │  │  │  │  │  │  │  │  │  ├─ -1 [id HM] shape=()
       │  │     │  │  │  │  │  │  │  │  │  │  │  └─ Switch [id IK] shape=() 't29'
       │  │     │  │  │  │  │  │  │  │  │  │  │     └─ ···
       │  │     │  │  │  │  │  │  │  │  │  │  └─ i3 [id HN] shape=()
       │  │     │  │  │  │  │  │  │  │  │  ├─ i4 [id IN] shape=()
       │  │     │  │  │  │  │  │  │  │  │  └─ Switch [id II] shape=() 't35'
       │  │     │  │  │  │  │  │  │  │  │     └─ ···
       │  │     │  │  │  │  │  │  │  │  └─ 1 [id HP] shape=()
       │  │     │  │  │  │  │  │  │  └─ sub [id IO] shape=()
       │  │     │  │  │  │  │  │  │     ├─ Switch [id IP] shape=()
       │  │     │  │  │  │  │  │  │     │  ├─ LT [id IQ] shape=()
       │  │     │  │  │  │  │  │  │     │  │  ├─ add [id IR] shape=() 't88'
       │  │     │  │  │  │  │  │  │     │  │  │  ├─ int_div [id IS] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  ├─ sub [id IT] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  ├─ sub [id IU] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ Switch [id IG] shape=() 't41'
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  │  └─ ···
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  └─ Switch [id IV] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     ├─ GE [id IW] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  ├─ Switch [id IX] shape=() 't62'
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  ├─ LT [id IY] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  ├─ Switch [id IZ] shape=() 't56'
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  ├─ i5 [id JA] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  ├─ i6 [id JB] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  └─ i7 [id JC] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  └─ 0 [id HL] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  ├─ -1 [id HM] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  └─ Switch [id IZ] shape=() 't56'
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  │     └─ ···
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     │  └─ i3 [id HN] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     ├─ i3 [id HN] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │     └─ Switch [id IX] shape=() 't62'
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  │        └─ ···
       │  │     │  │  │  │  │  │  │     │  │  │  │  │  └─ 1 [id HP] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  │  └─ 1 [id JD] shape=()
       │  │     │  │  │  │  │  │  │     │  │  │  └─ 1 [id HP] shape=()
       │  │     │  │  │  │  │  │  │     │  │  └─ 0 [id HL] shape=()
       │  │     │  │  │  │  │  │  │     │  ├─ 0 [id HL] shape=()
       │  │     │  │  │  │  │  │  │     │  └─ add [id IR] shape=() 't88'
       │  │     │  │  │  │  │  │  │     │     └─ ···
       │  │     │  │  │  │  │  │  │     └─ 1 [id HP] shape=()
       │  │     │  │  │  │  │  │  └─ 1 [id HP] shape=()
       │  │     │  │  │  │  │  └─ 0 [id HL] shape=()
       │  │     │  │  │  │  ├─ sub [id JE] shape=()
       │  │     │  │  │  │  │  ├─ add [id IF] shape=() 't44'
       │  │     │  │  │  │  │  │  └─ ···
       │  │     │  │  │  │  │  └─ 1 [id HP] shape=()
       │  │     │  │  │  │  └─ sub [id ID] shape=() 't4'
       │  │     │  │  │  │     └─ ···
       │  │     │  │  │  └─ 0 [id HL] shape=()
       │  │     │  │  ├─ 0 [id HL] shape=()
       │  │     │  │  └─ Switch [id IB] shape=() 't14'
       │  │     │  │     └─ ···
       │  │     │  └─ Switch [id JF] shape=() 't52'
       │  │     │     ├─ LT [id JG] shape=()
       │  │     │     │  ├─ add [id IF] shape=() 't44'
       │  │     │     │  │  └─ ···
       │  │     │     │  └─ 0 [id HL] shape=()
       │  │     │     ├─ 0 [id HL] shape=()
       │  │     │     └─ add [id IF] shape=() 't44'
       │  │     │        └─ ···
       │  │     ├─ Switch [id HZ] shape=() 't20'
       │  │     │  └─ ···
       │  │     └─ Switch [id JF] shape=() 't52'
       │  │        └─ ···
       │  └─ 1 [id HP] shape=()
       └─ 2 [id JH] shape=()
 ← add [id JI] shape=() 'o2'
    ├─ sub [id JJ] shape=()
    │  ├─ sub [id JK] shape=()
    │  │  ├─ Switch [id JL] shape=()
    │  │  │  ├─ LT [id JM] shape=()
    │  │  │  │  ├─ Switch [id JN] shape=() 't16'
    │  │  │  │  │  ├─ LT [id JO] shape=()
    │  │  │  │  │  │  ├─ Switch [id JP] shape=() 't9'
    │  │  │  │  │  │  │  ├─ LT [id JQ] shape=()
    │  │  │  │  │  │  │  │  ├─ sub [id JR] shape=() 't1'
    │  │  │  │  │  │  │  │  │  ├─ sub [id JS] shape=()
    │  │  │  │  │  │  │  │  │  │  ├─ add [id HC] shape=() 't8'
    │  │  │  │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  │  │  │  └─ sub [id JT] shape=()
    │  │  │  │  │  │  │  │  │  │     ├─ Switch [id JU] shape=()
    │  │  │  │  │  │  │  │  │  │     │  ├─ LT [id JV] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  ├─ add [id JW] shape=() 't82'
    │  │  │  │  │  │  │  │  │  │     │  │  │  ├─ int_div [id JX] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  ├─ sub [id JY] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  ├─ sub [id JZ] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ Switch [id HD] shape=() 't5'
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │  └─ Switch [id KA] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     ├─ GE [id KB] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  ├─ Switch [id KC] shape=() 't58'
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  ├─ LT [id KD] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  ├─ Switch [id KE] shape=() 't51'
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  ├─ i12 [id KF] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  ├─ i13 [id KG] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  │  └─ i7 [id JC] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  │  └─ 0 [id HL] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  ├─ -1 [id HM] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │  └─ Switch [id KE] shape=() 't51'
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  │     └─ ···
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     │  └─ i3 [id HN] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     ├─ i3 [id HN] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │     └─ Switch [id KC] shape=() 't58'
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  │        └─ ···
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  │  └─ 1 [id HP] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  │  └─ 1 [id JD] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  │  └─ 1 [id HP] shape=()
    │  │  │  │  │  │  │  │  │  │     │  │  └─ 0 [id HL] shape=()
    │  │  │  │  │  │  │  │  │  │     │  ├─ 0 [id HL] shape=()
    │  │  │  │  │  │  │  │  │  │     │  └─ add [id JW] shape=() 't82'
    │  │  │  │  │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │  │  │  │  │     └─ 1 [id HP] shape=()
    │  │  │  │  │  │  │  │  │  └─ 1 [id HP] shape=()
    │  │  │  │  │  │  │  │  └─ 0 [id HL] shape=()
    │  │  │  │  │  │  │  ├─ sub [id KH] shape=()
    │  │  │  │  │  │  │  │  ├─ add [id HC] shape=() 't8'
    │  │  │  │  │  │  │  │  │  └─ ···
    │  │  │  │  │  │  │  │  └─ 1 [id HP] shape=()
    │  │  │  │  │  │  │  └─ sub [id JR] shape=() 't1'
    │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  └─ 0 [id HL] shape=()
    │  │  │  │  │  ├─ 0 [id HL] shape=()
    │  │  │  │  │  └─ Switch [id JP] shape=() 't9'
    │  │  │  │  │     └─ ···
    │  │  │  │  └─ Switch [id HA] shape=() 't15'
    │  │  │  │     └─ ···
    │  │  │  ├─ Switch [id JN] shape=() 't16'
    │  │  │  │  └─ ···
    │  │  │  └─ Switch [id HA] shape=() 't15'
    │  │  │     └─ ···
    │  │  └─ maximum [id GX] shape=() 'o0'
    │  │     └─ ···
    │  └─ 1 [id HP] shape=()
    └─ maximum [id HU] shape=() 't37'
       └─ ···
 ← LT [id KI] shape=() 'o3'
    ├─ add [id HR] shape=() 'o1'
    │  └─ ···
    └─ 0 [id HL] shape=()
 ← LT [id KJ] shape=() 'o4'
    ├─ add [id JI] shape=() 'o2'
    │  └─ ···
    └─ 0 [id HL] shape=()
 ← LT [id KK] shape=() 'o5'
    ├─ add [id HR] shape=() 'o1'
    │  └─ ···
    └─ 0 [id HL] shape=()
 ← LT [id KL] shape=() 'o6'
    ├─ add [id JI] shape=() 'o2'
    │  └─ ···
    └─ 0 [id HL] shape=()
 ← add [id KM] shape=() 'o7'
    ├─ Switch [id KN] shape=()
    │  ├─ GT [id KO] shape=()
    │  │  ├─ 1 [id HP] shape=()
    │  │  └─ maximum [id HU] shape=() 't37'
    │  │     └─ ···
    │  ├─ add [id KP] shape=()
    │  │  ├─ maximum [id HU] shape=() 't37'
    │  │  │  └─ ···
    │  │  └─ 1 [id HP] shape=()
    │  └─ sub [id KQ] shape=()
    │     ├─ maximum [id HU] shape=() 't37'
    │     │  └─ ···
    │     └─ 1 [id HP] shape=()
    └─ 1 [id JD] shape=()
 ← sub [id KR] shape=() 'o8'
    ├─ neg [id KS] shape=()
    │  └─ add [id KM] shape=() 'o7'
    │     └─ ···
    └─ 1 [id HP] shape=()
Composite{...} [id R]
 ← Switch [id KT] shape=() 'o0'
    ├─ LE [id KU] shape=() 't52'
    │  ├─ sub [id KV] shape=() 't48'
    │  │  ├─ Switch [id KW] shape=() 't8'
    │  │  │  ├─ LT [id KX] shape=()
    │  │  │  │  ├─ add [id KY] shape=() 't49'
    │  │  │  │  │  ├─ 1 [id KZ] shape=()
    │  │  │  │  │  └─ Switch [id LA] shape=() 't40'
    │  │  │  │  │     ├─ GE [id LB] shape=()
    │  │  │  │  │     │  ├─ Switch [id LC] shape=() 't17'
    │  │  │  │  │     │  │  ├─ LT [id LD] shape=()
    │  │  │  │  │     │  │  │  ├─ Switch [id LE] shape=() 't11'
    │  │  │  │  │     │  │  │  │  ├─ i0 [id LF] shape=()
    │  │  │  │  │     │  │  │  │  ├─ i1 [id LG] shape=()
    │  │  │  │  │     │  │  │  │  └─ i2 [id LH] shape=()
    │  │  │  │  │     │  │  │  └─ 0 [id LI] shape=()
    │  │  │  │  │     │  │  ├─ -1 [id LJ] shape=()
    │  │  │  │  │     │  │  └─ Switch [id LE] shape=() 't11'
    │  │  │  │  │     │  │     └─ ···
    │  │  │  │  │     │  └─ i3 [id LK] shape=()
    │  │  │  │  │     ├─ i4 [id LL] shape=()
    │  │  │  │  │     └─ Switch [id LC] shape=() 't17'
    │  │  │  │  │        └─ ···
    │  │  │  │  └─ 0 [id LI] shape=()
    │  │  │  ├─ 0 [id LI] shape=()
    │  │  │  └─ add [id KY] shape=() 't49'
    │  │  │     └─ ···
    │  │  └─ Switch [id LM] shape=() 't37'
    │  │     ├─ LT [id LN] shape=()
    │  │     │  ├─ Switch [id LO] shape=() 't21'
    │  │     │  │  ├─ LT [id LP] shape=()
    │  │     │  │  │  ├─ Switch [id LQ] shape=() 't6'
    │  │     │  │  │  │  ├─ LT [id LR] shape=()
    │  │     │  │  │  │  │  ├─ sub [id LS] shape=() 't44'
    │  │     │  │  │  │  │  │  ├─ add [id KY] shape=() 't49'
    │  │     │  │  │  │  │  │  │  └─ ···
    │  │     │  │  │  │  │  │  └─ Switch [id LT] shape=()
    │  │     │  │  │  │  │  │     ├─ LT [id LU] shape=()
    │  │     │  │  │  │  │  │     │  ├─ sub [id LV] shape=() 't23'
    │  │     │  │  │  │  │  │     │  │  ├─ Switch [id LA] shape=() 't40'
    │  │     │  │  │  │  │  │     │  │  │  └─ ···
    │  │     │  │  │  │  │  │     │  │  └─ Switch [id LW] shape=()
    │  │     │  │  │  │  │  │     │  │     ├─ GE [id LX] shape=()
    │  │     │  │  │  │  │  │     │  │     │  ├─ Switch [id LY] shape=() 't0'
    │  │     │  │  │  │  │  │     │  │     │  │  ├─ LT [id LZ] shape=()
    │  │     │  │  │  │  │  │     │  │     │  │  │  ├─ Switch [id MA] shape=() 't39'
    │  │     │  │  │  │  │  │     │  │     │  │  │  │  ├─ i5 [id MB] shape=()
    │  │     │  │  │  │  │  │     │  │     │  │  │  │  ├─ i6 [id MC] shape=()
    │  │     │  │  │  │  │  │     │  │     │  │  │  │  └─ i7 [id MD] shape=()
    │  │     │  │  │  │  │  │     │  │     │  │  │  └─ 0 [id LI] shape=()
    │  │     │  │  │  │  │  │     │  │     │  │  ├─ -1 [id LJ] shape=()
    │  │     │  │  │  │  │  │     │  │     │  │  └─ Switch [id MA] shape=() 't39'
    │  │     │  │  │  │  │  │     │  │     │  │     └─ ···
    │  │     │  │  │  │  │  │     │  │     │  └─ i3 [id LK] shape=()
    │  │     │  │  │  │  │  │     │  │     ├─ i3 [id LK] shape=()
    │  │     │  │  │  │  │  │     │  │     └─ Switch [id LY] shape=() 't0'
    │  │     │  │  │  │  │  │     │  │        └─ ···
    │  │     │  │  │  │  │  │     │  └─ 0 [id LI] shape=()
    │  │     │  │  │  │  │  │     ├─ 0 [id LI] shape=()
    │  │     │  │  │  │  │  │     └─ sub [id LV] shape=() 't23'
    │  │     │  │  │  │  │  │        └─ ···
    │  │     │  │  │  │  │  └─ 0 [id LI] shape=()
    │  │     │  │  │  │  ├─ Switch [id LA] shape=() 't40'
    │  │     │  │  │  │  │  └─ ···
    │  │     │  │  │  │  └─ sub [id LS] shape=() 't44'
    │  │     │  │  │  │     └─ ···
    │  │     │  │  │  └─ 0 [id LI] shape=()
    │  │     │  │  ├─ 0 [id LI] shape=()
    │  │     │  │  └─ Switch [id LQ] shape=() 't6'
    │  │     │  │     └─ ···
    │  │     │  └─ Switch [id KW] shape=() 't8'
    │  │     │     └─ ···
    │  │     ├─ Switch [id LO] shape=() 't21'
    │  │     │  └─ ···
    │  │     └─ Switch [id KW] shape=() 't8'
    │  │        └─ ···
    │  └─ 0 [id LI] shape=()
    ├─ 0 [id LI] shape=()
    └─ maximum [id ME] shape=()
       ├─ minimum [id MF] shape=()
       │  ├─ add [id MG] shape=()
       │  │  ├─ -1 [id MH] shape=()
       │  │  └─ Switch [id KW] shape=() 't8'
       │  │     └─ ···
       │  └─ i3 [id LK] shape=()
       └─ 0 [id MI] shape=()
 ← Switch [id MJ] shape=() 'o1'
    ├─ LE [id KU] shape=() 't52'
    │  └─ ···
    ├─ 0 [id LI] shape=()
    └─ Switch [id MK] shape=()
       ├─ AND [id ML] shape=()
       │  ├─ LT [id MM] shape=()
       │  │  ├─ add [id MN] shape=() 't12'
       │  │  │  ├─ -1 [id MH] shape=()
       │  │  │  └─ Switch [id LM] shape=() 't37'
       │  │  │     └─ ···
       │  │  └─ 0 [id LI] shape=()
       │  └─ GT [id MO] shape=()
       │     ├─ sub [id KV] shape=() 't48'
       │     │  └─ ···
       │     └─ 0 [id LI] shape=()
       ├─ i8 [id MP] shape=()
       └─ minimum [id MQ] shape=()
          ├─ add [id MN] shape=() 't12'
          │  └─ ···
          └─ i3 [id LK] shape=()
 ← LT [id MR] shape=() 'o2'
    ├─ Switch [id KT] shape=() 'o0'
    │  └─ ···
    └─ 0 [id LI] shape=()
 ← LT [id MS] shape=() 'o3'
    ├─ Switch [id MJ] shape=() 'o1'
    │  └─ ···
    └─ 0 [id LI] shape=()
 ← LT [id MT] shape=() 'o4'
    ├─ Switch [id KT] shape=() 'o0'
    │  └─ ···
    └─ 0 [id LI] shape=()
 ← LT [id MU] shape=() 'o5'
    ├─ Switch [id MJ] shape=() 'o1'
    │  └─ ···
    └─ 0 [id LI] shape=()
Composite{...} [id S]
 ← Switch [id MV] shape=() 'o0'
    ├─ LE [id MW] shape=() 't4'
    │  ├─ Switch [id MX] shape=() 't17'
    │  │  ├─ i1 [id MY] shape=()
    │  │  ├─ Switch [id MZ] shape=()
    │  │  │  ├─ LT [id NA] shape=()
    │  │  │  │  ├─ i0 [id NB] shape=()
    │  │  │  │  └─ 0 [id NC] shape=()
    │  │  │  ├─ 0 [id NC] shape=()
    │  │  │  └─ i0 [id NB] shape=()
    │  │  └─ i2 [id ND] shape=()
    │  └─ 0 [id NC] shape=()
    ├─ 0 [id NC] shape=()
    └─ i4 [id NE] shape=()
 ← LT [id NF] shape=() 'o1'
    ├─ Switch [id MV] shape=() 'o0'
    │  └─ ···
    └─ 0 [id NC] shape=()
 ← Switch [id NG] shape=() 'o2'
    ├─ LE [id MW] shape=() 't4'
    │  └─ ···
    ├─ 0 [id NC] shape=()
    └─ Switch [id NH] shape=()
       ├─ AND [id NI] shape=()
       │  ├─ LT [id NJ] shape=()
       │  │  ├─ sub [id NK] shape=() 't16'
       │  │  │  ├─ i3 [id NL] shape=()
       │  │  │  └─ Switch [id MX] shape=() 't17'
       │  │  │     └─ ···
       │  │  └─ 0 [id NC] shape=()
       │  └─ GT [id NM] shape=()
       │     ├─ Switch [id MX] shape=() 't17'
       │     │  └─ ···
       │     └─ 0 [id NC] shape=()
       ├─ i5 [id NN] shape=()
       └─ maximum [id NO] shape=()
          ├─ i6 [id NP] shape=()
          └─ sub [id NK] shape=() 't16'
             └─ ···
 ← LT [id NQ] shape=() 'o3'
    ├─ Switch [id NG] shape=() 'o2'
    │  └─ ···
    └─ 0 [id NC] shape=()
Composite{...} [id X]
 ← sub [id NR] shape=() 'o0'
    ├─ Switch [id NS] shape=() 't14'
    │  ├─ LT [id NT] shape=()
    │  │  ├─ Switch [id NU] shape=() 'o3'
    │  │  │  ├─ LT [id NV] shape=() 'o2'
    │  │  │  │  ├─ i0 [id NW] shape=()
    │  │  │  │  └─ 0 [id NX] shape=()
    │  │  │  ├─ 0 [id NX] shape=()
    │  │  │  └─ i0 [id NW] shape=()
    │  │  └─ 0 [id NX] shape=()
    │  ├─ 0 [id NX] shape=()
    │  └─ Switch [id NU] shape=() 'o3'
    │     └─ ···
    └─ Switch [id NY] shape=() 't16'
       ├─ LT [id NZ] shape=()
       │  ├─ Switch [id OA] shape=() 't8'
       │  │  ├─ LT [id OB] shape=()
       │  │  │  ├─ Switch [id OC] shape=() 't0'
       │  │  │  │  ├─ LT [id OD] shape=()
       │  │  │  │  │  ├─ sub [id OE] shape=() 't18'
       │  │  │  │  │  │  ├─ Switch [id NU] shape=() 'o3'
       │  │  │  │  │  │  │  └─ ···
       │  │  │  │  │  │  └─ Switch [id NS] shape=() 't14'
       │  │  │  │  │  │     └─ ···
       │  │  │  │  │  └─ 0 [id NX] shape=()
       │  │  │  │  ├─ add [id OF] shape=() 'o4'
       │  │  │  │  │  ├─ -1 [id OG] shape=()
       │  │  │  │  │  └─ Switch [id NU] shape=() 'o3'
       │  │  │  │  │     └─ ···
       │  │  │  │  └─ sub [id OE] shape=() 't18'
       │  │  │  │     └─ ···
       │  │  │  └─ 0 [id NX] shape=()
       │  │  ├─ 0 [id NX] shape=()
       │  │  └─ Switch [id OC] shape=() 't0'
       │  │     └─ ···
       │  └─ Switch [id NS] shape=() 't14'
       │     └─ ···
       ├─ Switch [id OA] shape=() 't8'
       │  └─ ···
       └─ Switch [id NS] shape=() 't14'
          └─ ···
 ← Switch [id OH] shape=() 'o1'
    ├─ LT [id OI] shape=()
    │  ├─ i0 [id NW] shape=()
    │  └─ sub [id NR] shape=() 'o0'
    │     └─ ···
    ├─ i0 [id NW] shape=()
    └─ sub [id NR] shape=() 'o0'
       └─ ···
 ← LT [id NV] shape=() 'o2'
    └─ ···
 ← Switch [id NU] shape=() 'o3'
    └─ ···
 ← add [id OF] shape=() 'o4'
    └─ ···
 ← add [id OJ] shape=() 'o5'
    ├─ -1 [id OG] shape=()
    └─ Switch [id NS] shape=() 't14'
       └─ ···
 ← sub [id OK] shape=() 'o6'
    ├─ -1 [id OG] shape=()
    └─ Switch [id NU] shape=() 'o3'
       └─ ···
 ← maximum [id OL] shape=() 'o7'
    ├─ Switch [id NY] shape=() 't16'
    │  └─ ···
    └─ add [id OJ] shape=() 'o5'
       └─ ···
 ← add [id OM] shape=() 'o8'
    ├─ -1 [id OG] shape=()
    └─ Switch [id NY] shape=() 't16'
       └─ ···
 ← sub [id ON] shape=() 'o9'
    ├─ -2 [id OO] shape=()
    └─ i0 [id NW] shape=()
Composite{...} [id BT]
 ← Switch [id OP] shape=() 'o0'
    ├─ LE [id OQ] shape=() 't41'
    │  ├─ sub [id OR] shape=() 't26'
    │  │  ├─ Switch [id OS] shape=() 't24'
    │  │  │  ├─ LT [id OT] shape=()
    │  │  │  │  ├─ add [id OU] shape=() 't16'
    │  │  │  │  │  ├─ sub [id OV] shape=() 't11'
    │  │  │  │  │  │  ├─ sub [id OW] shape=()
    │  │  │  │  │  │  │  ├─ Switch [id OX] shape=() 't66'
    │  │  │  │  │  │  │  │  ├─ LT [id OY] shape=()
    │  │  │  │  │  │  │  │  │  ├─ Switch [id OZ] shape=() 't62'
    │  │  │  │  │  │  │  │  │  │  ├─ GE [id PA] shape=()
    │  │  │  │  │  │  │  │  │  │  │  ├─ Switch [id PB] shape=() 't55'
    │  │  │  │  │  │  │  │  │  │  │  │  ├─ LT [id PC] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ Switch [id PD] shape=() 't49'
    │  │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ i7 [id PE] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ i8 [id PF] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  │  └─ i2 [id PG] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  └─ 0 [id PH] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  ├─ -1 [id PI] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  └─ Switch [id PD] shape=() 't49'
    │  │  │  │  │  │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │  │  │  │  │  └─ i3 [id PJ] shape=()
    │  │  │  │  │  │  │  │  │  │  ├─ i3 [id PJ] shape=()
    │  │  │  │  │  │  │  │  │  │  └─ Switch [id PB] shape=() 't55'
    │  │  │  │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │  │  │  └─ 0 [id PH] shape=()
    │  │  │  │  │  │  │  │  ├─ 0 [id PH] shape=()
    │  │  │  │  │  │  │  │  └─ Switch [id OZ] shape=() 't62'
    │  │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │  └─ Switch [id PK] shape=()
    │  │  │  │  │  │  │     ├─ LT [id PL] shape=()
    │  │  │  │  │  │  │     │  ├─ Switch [id PM] shape=() 't82'
    │  │  │  │  │  │  │     │  │  ├─ LT [id PN] shape=()
    │  │  │  │  │  │  │     │  │  │  ├─ Switch [id PO] shape=() 't78'
    │  │  │  │  │  │  │     │  │  │  │  ├─ GE [id PP] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  ├─ Switch [id PQ] shape=() 't74'
    │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ LT [id PR] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  ├─ Switch [id PS] shape=() 't68'
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  │  ├─ i9 [id PT] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  │  ├─ i10 [id PU] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  │  └─ i6 [id PV] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  └─ 0 [id PH] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ 0 [id PH] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  └─ Switch [id PS] shape=() 't68'
    │  │  │  │  │  │  │     │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │     │  │  │  │  │  └─ i3 [id PJ] shape=()
    │  │  │  │  │  │  │     │  │  │  │  ├─ i3 [id PJ] shape=()
    │  │  │  │  │  │  │     │  │  │  │  └─ Switch [id PQ] shape=() 't74'
    │  │  │  │  │  │  │     │  │  │  │     └─ ···
    │  │  │  │  │  │  │     │  │  │  └─ 0 [id PH] shape=()
    │  │  │  │  │  │  │     │  │  ├─ 0 [id PH] shape=()
    │  │  │  │  │  │  │     │  │  └─ Switch [id PO] shape=() 't78'
    │  │  │  │  │  │  │     │  │     └─ ···
    │  │  │  │  │  │  │     │  └─ Switch [id OX] shape=() 't66'
    │  │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │  │     ├─ Switch [id PM] shape=() 't82'
    │  │  │  │  │  │  │     │  └─ ···
    │  │  │  │  │  │  │     └─ Switch [id OX] shape=() 't66'
    │  │  │  │  │  │  │        └─ ···
    │  │  │  │  │  │  └─ 1 [id PW] shape=()
    │  │  │  │  │  └─ 1 [id PW] shape=()
    │  │  │  │  └─ 0 [id PH] shape=()
    │  │  │  ├─ 0 [id PH] shape=()
    │  │  │  └─ add [id OU] shape=() 't16'
    │  │  │     └─ ···
    │  │  └─ Switch [id PX] shape=() 't69'
    │  │     ├─ LT [id PY] shape=()
    │  │     │  ├─ Switch [id PZ] shape=() 't65'
    │  │     │  │  ├─ LT [id QA] shape=()
    │  │     │  │  │  ├─ Switch [id QB] shape=() 't61'
    │  │     │  │  │  │  ├─ LT [id QC] shape=()
    │  │     │  │  │  │  │  ├─ sub [id QD] shape=() 't51'
    │  │     │  │  │  │  │  │  ├─ sub [id QE] shape=()
    │  │     │  │  │  │  │  │  │  ├─ add [id OU] shape=() 't16'
    │  │     │  │  │  │  │  │  │  │  └─ ···
    │  │     │  │  │  │  │  │  │  └─ sub [id QF] shape=()
    │  │     │  │  │  │  │  │  │     ├─ Switch [id QG] shape=()
    │  │     │  │  │  │  │  │  │     │  ├─ LT [id QH] shape=()
    │  │     │  │  │  │  │  │  │     │  │  ├─ add [id QI] shape=() 't36'
    │  │     │  │  │  │  │  │  │     │  │  │  ├─ int_div [id QJ] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  ├─ sub [id QK] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  ├─ sub [id QL] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ sub [id OV] shape=() 't11'
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  │  └─ ···
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  └─ -1 [id PI] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  └─ 1 [id PW] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  └─ 1 [id QM] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  └─ 1 [id PW] shape=()
    │  │     │  │  │  │  │  │  │     │  │  └─ 0 [id PH] shape=()
    │  │     │  │  │  │  │  │  │     │  ├─ 0 [id PH] shape=()
    │  │     │  │  │  │  │  │  │     │  └─ add [id QI] shape=() 't36'
    │  │     │  │  │  │  │  │  │     │     └─ ···
    │  │     │  │  │  │  │  │  │     └─ 1 [id PW] shape=()
    │  │     │  │  │  │  │  │  └─ 1 [id PW] shape=()
    │  │     │  │  │  │  │  └─ 0 [id PH] shape=()
    │  │     │  │  │  │  ├─ sub [id QN] shape=()
    │  │     │  │  │  │  │  ├─ add [id OU] shape=() 't16'
    │  │     │  │  │  │  │  │  └─ ···
    │  │     │  │  │  │  │  └─ 1 [id PW] shape=()
    │  │     │  │  │  │  └─ sub [id QD] shape=() 't51'
    │  │     │  │  │  │     └─ ···
    │  │     │  │  │  └─ 0 [id PH] shape=()
    │  │     │  │  ├─ 0 [id PH] shape=()
    │  │     │  │  └─ Switch [id QB] shape=() 't61'
    │  │     │  │     └─ ···
    │  │     │  └─ Switch [id OS] shape=() 't24'
    │  │     │     └─ ···
    │  │     ├─ Switch [id PZ] shape=() 't65'
    │  │     │  └─ ···
    │  │     └─ Switch [id OS] shape=() 't24'
    │  │        └─ ···
    │  └─ 0 [id PH] shape=()
    ├─ 0 [id PH] shape=()
    └─ Switch [id QO] shape=()
       ├─ AND [id QP] shape=()
       │  ├─ LT [id QQ] shape=()
       │  │  ├─ add [id QR] shape=() 't19'
       │  │  │  ├─ Switch [id QS] shape=() 't13'
       │  │  │  │  ├─ LT [id QT] shape=()
       │  │  │  │  │  ├─ Switch [id QU] shape=() 't3'
       │  │  │  │  │  │  ├─ LT [id QV] shape=()
       │  │  │  │  │  │  │  ├─ Switch [id QW] shape=() 't83'
       │  │  │  │  │  │  │  │  ├─ GE [id QX] shape=()
       │  │  │  │  │  │  │  │  │  ├─ Switch [id QY] shape=() 't79'
       │  │  │  │  │  │  │  │  │  │  ├─ LT [id QZ] shape=()
       │  │  │  │  │  │  │  │  │  │  │  ├─ Switch [id RA] shape=() 't75'
       │  │  │  │  │  │  │  │  │  │  │  │  ├─ i4 [id RB] shape=()
       │  │  │  │  │  │  │  │  │  │  │  │  ├─ i5 [id RC] shape=()
       │  │  │  │  │  │  │  │  │  │  │  │  └─ i6 [id PV] shape=()
       │  │  │  │  │  │  │  │  │  │  │  └─ 0 [id PH] shape=()
       │  │  │  │  │  │  │  │  │  │  ├─ 0 [id PH] shape=()
       │  │  │  │  │  │  │  │  │  │  └─ Switch [id RA] shape=() 't75'
       │  │  │  │  │  │  │  │  │  │     └─ ···
       │  │  │  │  │  │  │  │  │  └─ i3 [id PJ] shape=()
       │  │  │  │  │  │  │  │  ├─ i3 [id PJ] shape=()
       │  │  │  │  │  │  │  │  └─ Switch [id QY] shape=() 't79'
       │  │  │  │  │  │  │  │     └─ ···
       │  │  │  │  │  │  │  └─ 0 [id PH] shape=()
       │  │  │  │  │  │  ├─ 0 [id PH] shape=()
       │  │  │  │  │  │  └─ Switch [id QW] shape=() 't83'
       │  │  │  │  │  │     └─ ···
       │  │  │  │  │  └─ Switch [id RD] shape=() 't46'
       │  │  │  │  │     ├─ LT [id RE] shape=()
       │  │  │  │  │     │  ├─ Switch [id RF] shape=() 't40'
       │  │  │  │  │     │  │  ├─ GE [id RG] shape=()
       │  │  │  │  │     │  │  │  ├─ Switch [id RH] shape=() 't6'
       │  │  │  │  │     │  │  │  │  ├─ LT [id RI] shape=()
       │  │  │  │  │     │  │  │  │  │  ├─ Switch [id RJ] shape=() 't71'
       │  │  │  │  │     │  │  │  │  │  │  ├─ i0 [id RK] shape=()
       │  │  │  │  │     │  │  │  │  │  │  ├─ i1 [id RL] shape=()
       │  │  │  │  │     │  │  │  │  │  │  └─ i2 [id PG] shape=()
       │  │  │  │  │     │  │  │  │  │  └─ 0 [id PH] shape=()
       │  │  │  │  │     │  │  │  │  ├─ -1 [id PI] shape=()
       │  │  │  │  │     │  │  │  │  └─ Switch [id RJ] shape=() 't71'
       │  │  │  │  │     │  │  │  │     └─ ···
       │  │  │  │  │     │  │  │  └─ i3 [id PJ] shape=()
       │  │  │  │  │     │  │  ├─ i3 [id PJ] shape=()
       │  │  │  │  │     │  │  └─ Switch [id RH] shape=() 't6'
       │  │  │  │  │     │  │     └─ ···
       │  │  │  │  │     │  └─ 0 [id PH] shape=()
       │  │  │  │  │     ├─ 0 [id PH] shape=()
       │  │  │  │  │     └─ Switch [id RF] shape=() 't40'
       │  │  │  │  │        └─ ···
       │  │  │  │  ├─ Switch [id QU] shape=() 't3'
       │  │  │  │  │  └─ ···
       │  │  │  │  └─ Switch [id RD] shape=() 't46'
       │  │  │  │     └─ ···
       │  │  │  └─ sub [id RM] shape=()
       │  │  │     ├─ Switch [id PX] shape=() 't69'
       │  │  │     │  └─ ···
       │  │  │     └─ 1 [id PW] shape=()
       │  │  └─ 0 [id PH] shape=()
       │  └─ GT [id RN] shape=()
       │     ├─ sub [id OR] shape=() 't26'
       │     │  └─ ···
       │     └─ 0 [id PH] shape=()
       ├─ i11 [id RO] shape=()
       └─ minimum [id RP] shape=()
          ├─ add [id QR] shape=() 't19'
          │  └─ ···
          └─ Switch [id RD] shape=() 't46'
             └─ ···
 ← Switch [id RQ] shape=() 'o1'
    ├─ LE [id OQ] shape=() 't41'
    │  └─ ···
    ├─ 0 [id PH] shape=()
    └─ maximum [id RR] shape=()
       ├─ minimum [id RS] shape=()
       │  ├─ add [id RT] shape=()
       │  │  ├─ Switch [id QS] shape=() 't13'
       │  │  │  └─ ···
       │  │  └─ sub [id RU] shape=()
       │  │     ├─ Switch [id OS] shape=() 't24'
       │  │     │  └─ ···
       │  │     └─ 1 [id PW] shape=()
       │  └─ Switch [id RD] shape=() 't46'
       │     └─ ···
       └─ 0 [id PH] shape=()
Composite{((i0 + 1) - switch(lt(1, (i0 + 1)), 1, (i0 + 1)))} [id CJ]
 ← sub [id RV] shape=() 'o0'
    ├─ add [id RW] shape=() 't4'
    │  ├─ i0 [id RX] shape=()
    │  └─ 1 [id RY] shape=()
    └─ Switch [id RZ] shape=()
       ├─ LT [id SA] shape=()
       │  ├─ 1 [id RY] shape=()
       │  └─ add [id RW] shape=() 't4'
       │     └─ ···
       ├─ 1 [id RY] shape=()
       └─ add [id RW] shape=() 't4'
          └─ ···
Composite{...} [id CM]
 ← Switch [id SB] shape=() 'o0'
    ├─ LE [id SC] shape=() 't39'
    │  ├─ sub [id SD] shape=() 't27'
    │  │  ├─ Switch [id SE] shape=() 't26'
    │  │  │  ├─ LT [id SF] shape=()
    │  │  │  │  ├─ add [id SG] shape=() 't20'
    │  │  │  │  │  ├─ sub [id SH] shape=() 't18'
    │  │  │  │  │  │  ├─ sub [id SI] shape=()
    │  │  │  │  │  │  │  ├─ Switch [id SJ] shape=() 't66'
    │  │  │  │  │  │  │  │  ├─ LT [id SK] shape=()
    │  │  │  │  │  │  │  │  │  ├─ Switch [id SL] shape=() 't62'
    │  │  │  │  │  │  │  │  │  │  ├─ GE [id SM] shape=()
    │  │  │  │  │  │  │  │  │  │  │  ├─ Switch [id SN] shape=() 't55'
    │  │  │  │  │  │  │  │  │  │  │  │  ├─ LT [id SO] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ Switch [id SP] shape=() 't49'
    │  │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ i7 [id SQ] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  │  ├─ i8 [id SR] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  │  └─ i2 [id SS] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  │  └─ 0 [id ST] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  ├─ -1 [id SU] shape=()
    │  │  │  │  │  │  │  │  │  │  │  │  └─ Switch [id SP] shape=() 't49'
    │  │  │  │  │  │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │  │  │  │  │  └─ i3 [id SV] shape=()
    │  │  │  │  │  │  │  │  │  │  ├─ i3 [id SV] shape=()
    │  │  │  │  │  │  │  │  │  │  └─ Switch [id SN] shape=() 't55'
    │  │  │  │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │  │  │  └─ 0 [id ST] shape=()
    │  │  │  │  │  │  │  │  ├─ 0 [id ST] shape=()
    │  │  │  │  │  │  │  │  └─ Switch [id SL] shape=() 't62'
    │  │  │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │  └─ Switch [id SW] shape=()
    │  │  │  │  │  │  │     ├─ LT [id SX] shape=()
    │  │  │  │  │  │  │     │  ├─ Switch [id SY] shape=() 't4'
    │  │  │  │  │  │  │     │  │  ├─ LT [id SZ] shape=()
    │  │  │  │  │  │  │     │  │  │  ├─ Switch [id TA] shape=() 't83'
    │  │  │  │  │  │  │     │  │  │  │  ├─ GE [id TB] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  ├─ Switch [id TC] shape=() 't78'
    │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ LT [id TD] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  ├─ Switch [id TE] shape=() 't69'
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  │  ├─ i9 [id TF] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  │  ├─ i10 [id TG] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  │  └─ i6 [id TH] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  │  └─ 0 [id ST] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ 0 [id ST] shape=()
    │  │  │  │  │  │  │     │  │  │  │  │  │  └─ Switch [id TE] shape=() 't69'
    │  │  │  │  │  │  │     │  │  │  │  │  │     └─ ···
    │  │  │  │  │  │  │     │  │  │  │  │  └─ i3 [id SV] shape=()
    │  │  │  │  │  │  │     │  │  │  │  ├─ i3 [id SV] shape=()
    │  │  │  │  │  │  │     │  │  │  │  └─ Switch [id TC] shape=() 't78'
    │  │  │  │  │  │  │     │  │  │  │     └─ ···
    │  │  │  │  │  │  │     │  │  │  └─ 0 [id ST] shape=()
    │  │  │  │  │  │  │     │  │  ├─ 0 [id ST] shape=()
    │  │  │  │  │  │  │     │  │  └─ Switch [id TA] shape=() 't83'
    │  │  │  │  │  │  │     │  │     └─ ···
    │  │  │  │  │  │  │     │  └─ Switch [id SJ] shape=() 't66'
    │  │  │  │  │  │  │     │     └─ ···
    │  │  │  │  │  │  │     ├─ Switch [id SY] shape=() 't4'
    │  │  │  │  │  │  │     │  └─ ···
    │  │  │  │  │  │  │     └─ Switch [id SJ] shape=() 't66'
    │  │  │  │  │  │  │        └─ ···
    │  │  │  │  │  │  └─ 1 [id TI] shape=()
    │  │  │  │  │  └─ 1 [id TI] shape=()
    │  │  │  │  └─ 0 [id ST] shape=()
    │  │  │  ├─ 0 [id ST] shape=()
    │  │  │  └─ add [id SG] shape=() 't20'
    │  │  │     └─ ···
    │  │  └─ Switch [id TJ] shape=() 't70'
    │  │     ├─ LT [id TK] shape=()
    │  │     │  ├─ Switch [id TL] shape=() 't65'
    │  │     │  │  ├─ LT [id TM] shape=()
    │  │     │  │  │  ├─ Switch [id TN] shape=() 't61'
    │  │     │  │  │  │  ├─ LT [id TO] shape=()
    │  │     │  │  │  │  │  ├─ sub [id TP] shape=() 't51'
    │  │     │  │  │  │  │  │  ├─ sub [id TQ] shape=()
    │  │     │  │  │  │  │  │  │  ├─ add [id SG] shape=() 't20'
    │  │     │  │  │  │  │  │  │  │  └─ ···
    │  │     │  │  │  │  │  │  │  └─ sub [id TR] shape=()
    │  │     │  │  │  │  │  │  │     ├─ Switch [id TS] shape=()
    │  │     │  │  │  │  │  │  │     │  ├─ LT [id TT] shape=()
    │  │     │  │  │  │  │  │  │     │  │  ├─ add [id TU] shape=() 't35'
    │  │     │  │  │  │  │  │  │     │  │  │  ├─ int_div [id TV] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  ├─ sub [id TW] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  ├─ sub [id TX] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  ├─ sub [id SH] shape=() 't18'
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  │  └─ ···
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  │  └─ -1 [id SU] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  │  └─ 1 [id TI] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  │  └─ 1 [id TY] shape=()
    │  │     │  │  │  │  │  │  │     │  │  │  └─ 1 [id TI] shape=()
    │  │     │  │  │  │  │  │  │     │  │  └─ 0 [id ST] shape=()
    │  │     │  │  │  │  │  │  │     │  ├─ 0 [id ST] shape=()
    │  │     │  │  │  │  │  │  │     │  └─ add [id TU] shape=() 't35'
    │  │     │  │  │  │  │  │  │     │     └─ ···
    │  │     │  │  │  │  │  │  │     └─ 1 [id TI] shape=()
    │  │     │  │  │  │  │  │  └─ 1 [id TI] shape=()
    │  │     │  │  │  │  │  └─ 0 [id ST] shape=()
    │  │     │  │  │  │  ├─ sub [id TZ] shape=()
    │  │     │  │  │  │  │  ├─ add [id SG] shape=() 't20'
    │  │     │  │  │  │  │  │  └─ ···
    │  │     │  │  │  │  │  └─ 1 [id TI] shape=()
    │  │     │  │  │  │  └─ sub [id TP] shape=() 't51'
    │  │     │  │  │  │     └─ ···
    │  │     │  │  │  └─ 0 [id ST] shape=()
    │  │     │  │  ├─ 0 [id ST] shape=()
    │  │     │  │  └─ Switch [id TN] shape=() 't61'
    │  │     │  │     └─ ···
    │  │     │  └─ Switch [id SE] shape=() 't26'
    │  │     │     └─ ···
    │  │     ├─ Switch [id TL] shape=() 't65'
    │  │     │  └─ ···
    │  │     └─ Switch [id SE] shape=() 't26'
    │  │        └─ ···
    │  └─ 0 [id ST] shape=()
    ├─ 0 [id ST] shape=()
    └─ Switch [id UA] shape=()
       ├─ AND [id UB] shape=()
       │  ├─ LT [id UC] shape=()
       │  │  ├─ add [id UD] shape=() 't22'
       │  │  │  ├─ Switch [id UE] shape=() 't19'
       │  │  │  │  ├─ LT [id UF] shape=()
       │  │  │  │  │  ├─ Switch [id UG] shape=() 't11'
       │  │  │  │  │  │  ├─ LT [id UH] shape=()
       │  │  │  │  │  │  │  ├─ Switch [id UI] shape=() 't5'
       │  │  │  │  │  │  │  │  ├─ GE [id UJ] shape=()
       │  │  │  │  │  │  │  │  │  ├─ Switch [id UK] shape=() 't0'
       │  │  │  │  │  │  │  │  │  │  ├─ LT [id UL] shape=()
       │  │  │  │  │  │  │  │  │  │  │  ├─ Switch [id UM] shape=() 't79'
       │  │  │  │  │  │  │  │  │  │  │  │  ├─ i4 [id UN] shape=()
       │  │  │  │  │  │  │  │  │  │  │  │  ├─ i5 [id UO] shape=()
       │  │  │  │  │  │  │  │  │  │  │  │  └─ i6 [id TH] shape=()
       │  │  │  │  │  │  │  │  │  │  │  └─ 0 [id ST] shape=()
       │  │  │  │  │  │  │  │  │  │  ├─ 0 [id ST] shape=()
       │  │  │  │  │  │  │  │  │  │  └─ Switch [id UM] shape=() 't79'
       │  │  │  │  │  │  │  │  │  │     └─ ···
       │  │  │  │  │  │  │  │  │  └─ i3 [id SV] shape=()
       │  │  │  │  │  │  │  │  ├─ i3 [id SV] shape=()
       │  │  │  │  │  │  │  │  └─ Switch [id UK] shape=() 't0'
       │  │  │  │  │  │  │  │     └─ ···
       │  │  │  │  │  │  │  └─ 0 [id ST] shape=()
       │  │  │  │  │  │  ├─ 0 [id ST] shape=()
       │  │  │  │  │  │  └─ Switch [id UI] shape=() 't5'
       │  │  │  │  │  │     └─ ···
       │  │  │  │  │  └─ Switch [id UP] shape=() 't44'
       │  │  │  │  │     ├─ LT [id UQ] shape=()
       │  │  │  │  │     │  ├─ Switch [id UR] shape=() 't38'
       │  │  │  │  │     │  │  ├─ GE [id US] shape=()
       │  │  │  │  │     │  │  │  ├─ Switch [id UT] shape=() 't60'
       │  │  │  │  │     │  │  │  │  ├─ LT [id UU] shape=()
       │  │  │  │  │     │  │  │  │  │  ├─ Switch [id UV] shape=() 't74'
       │  │  │  │  │     │  │  │  │  │  │  ├─ i0 [id UW] shape=()
       │  │  │  │  │     │  │  │  │  │  │  ├─ i1 [id UX] shape=()
       │  │  │  │  │     │  │  │  │  │  │  └─ i2 [id SS] shape=()
       │  │  │  │  │     │  │  │  │  │  └─ 0 [id ST] shape=()
       │  │  │  │  │     │  │  │  │  ├─ -1 [id SU] shape=()
       │  │  │  │  │     │  │  │  │  └─ Switch [id UV] shape=() 't74'
       │  │  │  │  │     │  │  │  │     └─ ···
       │  │  │  │  │     │  │  │  └─ i3 [id SV] shape=()
       │  │  │  │  │     │  │  ├─ i3 [id SV] shape=()
       │  │  │  │  │     │  │  └─ Switch [id UT] shape=() 't60'
       │  │  │  │  │     │  │     └─ ···
       │  │  │  │  │     │  └─ 0 [id ST] shape=()
       │  │  │  │  │     ├─ 0 [id ST] shape=()
       │  │  │  │  │     └─ Switch [id UR] shape=() 't38'
       │  │  │  │  │        └─ ···
       │  │  │  │  ├─ Switch [id UG] shape=() 't11'
       │  │  │  │  │  └─ ···
       │  │  │  │  └─ Switch [id UP] shape=() 't44'
       │  │  │  │     └─ ···
       │  │  │  └─ sub [id UY] shape=()
       │  │  │     ├─ Switch [id TJ] shape=() 't70'
       │  │  │     │  └─ ···
       │  │  │     └─ 1 [id TI] shape=()
       │  │  └─ 0 [id ST] shape=()
       │  └─ GT [id UZ] shape=()
       │     ├─ sub [id SD] shape=() 't27'
       │     │  └─ ···
       │     └─ 0 [id ST] shape=()
       ├─ i11 [id VA] shape=()
       └─ minimum [id VB] shape=()
          ├─ add [id UD] shape=() 't22'
          │  └─ ···
          └─ Switch [id UP] shape=() 't44'
             └─ ···
 ← Switch [id VC] shape=() 'o1'
    ├─ LE [id SC] shape=() 't39'
    │  └─ ···
    ├─ 0 [id ST] shape=()
    └─ maximum [id VD] shape=()
       ├─ minimum [id VE] shape=()
       │  ├─ add [id VF] shape=()
       │  │  ├─ Switch [id UE] shape=() 't19'
       │  │  │  └─ ···
       │  │  └─ sub [id VG] shape=()
       │  │     ├─ Switch [id SE] shape=() 't26'
       │  │     │  └─ ···
       │  │     └─ 1 [id TI] shape=()
       │  └─ Switch [id UP] shape=() 't44'
       │     └─ ···
       └─ 0 [id ST] shape=()
Composite{((2.0 * i0 * i1) + i2)} [id CV]
 ← add [id VH] shape=() 'o0'
    ├─ mul [id VI] shape=()
    │  ├─ 2.0 [id VJ] shape=()
    │  ├─ i0 [id VK] shape=()
    │  └─ i1 [id VL] shape=()
    └─ i2 [id VM] shape=()

@ricardoV94
Copy link
Member

For scan I think we're mostly interested in 2 cases: x[taps:] and x[taps:][-1] plus some reversting with step -1. We should just handle the logic for those cases explicitly. Some extra complexity has to do with potential invalid indexes, for instance you can't do x[start:][-1] if x is smaller than start. We can add an assert for these cases or rewrite with a shape_unsafe tag.

@ricardoV94
Copy link
Member

It's so bad I'm marking it as a bug

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

No branches or pull requests

3 participants