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
"# Do one flattening operation; here equivalent to `.decompose_bloq()`\n",
492
+
"# on the original bloq.\n",
493
+
"flat_three_p = three_p.flatten_once()\n",
491
494
"show_bloq(flat_three_p)"
492
495
]
493
496
},
@@ -496,7 +499,7 @@
496
499
"id": "6f322361",
497
500
"metadata": {},
498
501
"source": [
499
-
"If we just decomposed all of the subbloqs, our diagram would look very similar except the subbloqs are now `CompositeBloq` container classes instead of the original `TestParallelBloq`."
502
+
"Now we have a `CompositeBloq` with three subbloqs. What if we wanted to continue decomposing? A naive approach would be to simply call `.decompose_bloq()` on each subbloqs. We'll do this in the next cell and see what happens."
500
503
]
501
504
},
502
505
{
@@ -523,6 +526,14 @@
523
526
"show_bloq(decompose_children)"
524
527
]
525
528
},
529
+
{
530
+
"cell_type": "markdown",
531
+
"id": "35b8a7d3-d54e-4b72-a50a-4fb047bf797c",
532
+
"metadata": {},
533
+
"source": [
534
+
"This is still a `CompositeBloq` with three subbloqs. The only difference is now the subbloqs are each compute graphs of their own. This likely isn't what we want. Instead, we want to do the equivalent of `flatMap` with the decompose operation: namely, decompose the subbloqs and remove a layer of nesting. This is what the `flatten_once` method achieves."
535
+
]
536
+
},
526
537
{
527
538
"cell_type": "code",
528
539
"execution_count": null,
@@ -532,10 +543,18 @@
532
543
"source": [
533
544
"# Actually do a flattening operation on all the subbloqs\n",
0 commit comments