Skip to content

Commit 0dd1ccf

Browse files
docs: strip notebook outputs (nbstripout)
1 parent ba24874 commit 0dd1ccf

2 files changed

Lines changed: 62 additions & 240 deletions

File tree

docs/coreai-core/tutorials/construct-a-graph.ipynb

Lines changed: 36 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "intro",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"# Constructing a CoreAI Graph\n",
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"cell_type": "markdown",
28-
"id": "warning",
28+
"id": "1",
2929
"metadata": {},
3030
"source": [
3131
":::{warning}\n",
@@ -39,7 +39,7 @@
3939
},
4040
{
4141
"cell_type": "markdown",
42-
"id": "setup-md",
42+
"id": "2",
4343
"metadata": {},
4444
"source": [
4545
"## Setup\n",
@@ -50,25 +50,10 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 1,
54-
"id": "imports",
55-
"metadata": {
56-
"execution": {
57-
"iopub.execute_input": "2026-06-04T23:13:09.232797Z",
58-
"iopub.status.busy": "2026-06-04T23:13:09.232330Z",
59-
"iopub.status.idle": "2026-06-04T23:13:12.445622Z",
60-
"shell.execute_reply": "2026-06-04T23:13:12.444678Z"
61-
}
62-
},
63-
"outputs": [
64-
{
65-
"name": "stderr",
66-
"output_type": "stream",
67-
"text": [
68-
"Dev installation detected. Using local Core AI Framework.\n"
69-
]
70-
}
71-
],
53+
"execution_count": null,
54+
"id": "3",
55+
"metadata": {},
56+
"outputs": [],
7257
"source": [
7358
"import shutil\n",
7459
"from pathlib import Path\n",
@@ -84,7 +69,7 @@
8469
},
8570
{
8671
"cell_type": "markdown",
87-
"id": "specs-md",
72+
"id": "4",
8873
"metadata": {},
8974
"source": [
9075
"## Describe the inputs and outputs\n",
@@ -99,26 +84,10 @@
9984
},
10085
{
10186
"cell_type": "code",
102-
"execution_count": 2,
103-
"id": "specs",
104-
"metadata": {
105-
"execution": {
106-
"iopub.execute_input": "2026-06-04T23:13:12.447443Z",
107-
"iopub.status.busy": "2026-06-04T23:13:12.447294Z",
108-
"iopub.status.idle": "2026-06-04T23:13:12.451834Z",
109-
"shell.execute_reply": "2026-06-04T23:13:12.451081Z"
110-
}
111-
},
112-
"outputs": [
113-
{
114-
"name": "stdout",
115-
"output_type": "stream",
116-
"text": [
117-
"input: tensor<2x3xf32>\n",
118-
"output: tensor<2x3xf32>\n"
119-
]
120-
}
121-
],
87+
"execution_count": null,
88+
"id": "5",
89+
"metadata": {},
90+
"outputs": [],
12291
"source": [
12392
"input_spec = TensorSpec(shape=[2, 3], dtype=np.float32)\n",
12493
"output_spec = TensorSpec(shape=[2, 3], dtype=np.float32, name=\"y\")\n",
@@ -129,7 +98,7 @@
12998
},
13099
{
131100
"cell_type": "markdown",
132-
"id": "build-md",
101+
"id": "6",
133102
"metadata": {},
134103
"source": [
135104
"## Build the graph\n",
@@ -145,25 +114,10 @@
145114
},
146115
{
147116
"cell_type": "code",
148-
"execution_count": 3,
149-
"id": "build",
150-
"metadata": {
151-
"execution": {
152-
"iopub.execute_input": "2026-06-04T23:13:12.453228Z",
153-
"iopub.status.busy": "2026-06-04T23:13:12.453111Z",
154-
"iopub.status.idle": "2026-06-04T23:13:12.470623Z",
155-
"shell.execute_reply": "2026-06-04T23:13:12.470201Z"
156-
}
157-
},
158-
"outputs": [
159-
{
160-
"name": "stdout",
161-
"output_type": "stream",
162-
"text": [
163-
"Module verified.\n"
164-
]
165-
}
166-
],
117+
"execution_count": null,
118+
"id": "7",
119+
"metadata": {},
120+
"outputs": [],
167121
"source": [
168122
"module = Module.create()\n",
169123
"with module:\n",
@@ -181,7 +135,7 @@
181135
},
182136
{
183137
"cell_type": "markdown",
184-
"id": "program-md",
138+
"id": "8",
185139
"metadata": {},
186140
"source": [
187141
"## Wrap in an `AIProgram`\n",
@@ -192,24 +146,17 @@
192146
},
193147
{
194148
"cell_type": "code",
195-
"execution_count": 4,
196-
"id": "program",
197-
"metadata": {
198-
"execution": {
199-
"iopub.execute_input": "2026-06-04T23:13:12.472009Z",
200-
"iopub.status.busy": "2026-06-04T23:13:12.471916Z",
201-
"iopub.status.idle": "2026-06-04T23:13:12.474216Z",
202-
"shell.execute_reply": "2026-06-04T23:13:12.473635Z"
203-
}
204-
},
149+
"execution_count": null,
150+
"id": "9",
151+
"metadata": {},
205152
"outputs": [],
206153
"source": [
207154
"program = AIProgram(module)"
208155
]
209156
},
210157
{
211158
"cell_type": "markdown",
212-
"id": "save-md",
159+
"id": "10",
213160
"metadata": {},
214161
"source": [
215162
"## Save as an `.aimodel`\n",
@@ -222,25 +169,10 @@
222169
},
223170
{
224171
"cell_type": "code",
225-
"execution_count": 5,
226-
"id": "save",
227-
"metadata": {
228-
"execution": {
229-
"iopub.execute_input": "2026-06-04T23:13:12.475505Z",
230-
"iopub.status.busy": "2026-06-04T23:13:12.475388Z",
231-
"iopub.status.idle": "2026-06-04T23:13:12.479489Z",
232-
"shell.execute_reply": "2026-06-04T23:13:12.479034Z"
233-
}
234-
},
235-
"outputs": [
236-
{
237-
"name": "stdout",
238-
"output_type": "stream",
239-
"text": [
240-
"saved to: hello-graph.aimodel\n"
241-
]
242-
}
243-
],
172+
"execution_count": null,
173+
"id": "11",
174+
"metadata": {},
175+
"outputs": [],
244176
"source": [
245177
"asset_path = Path(\"./hello-graph.aimodel\")\n",
246178
"if asset_path.exists():\n",
@@ -252,7 +184,7 @@
252184
},
253185
{
254186
"cell_type": "markdown",
255-
"id": "inspect-md",
187+
"id": "12",
256188
"metadata": {},
257189
"source": [
258190
"## Inspect the saved asset\n",
@@ -263,26 +195,10 @@
263195
},
264196
{
265197
"cell_type": "code",
266-
"execution_count": 6,
267-
"id": "inspect",
268-
"metadata": {
269-
"execution": {
270-
"iopub.execute_input": "2026-06-04T23:13:12.480788Z",
271-
"iopub.status.busy": "2026-06-04T23:13:12.480705Z",
272-
"iopub.status.idle": "2026-06-04T23:13:12.483398Z",
273-
"shell.execute_reply": "2026-06-04T23:13:12.483007Z"
274-
}
275-
},
276-
"outputs": [
277-
{
278-
"name": "stdout",
279-
"output_type": "stream",
280-
"text": [
281-
"contents: ['main.hash', 'main.mlirb', 'metadata.json']\n",
282-
"total size: 446 bytes\n"
283-
]
284-
}
285-
],
198+
"execution_count": null,
199+
"id": "13",
200+
"metadata": {},
201+
"outputs": [],
286202
"source": [
287203
"files = sorted(p.name for p in asset_path.iterdir())\n",
288204
"total_bytes = sum(p.stat().st_size for p in asset_path.rglob(\"*\") if p.is_file())\n",
@@ -293,7 +209,7 @@
293209
},
294210
{
295211
"cell_type": "markdown",
296-
"id": "validate-md",
212+
"id": "14",
297213
"metadata": {},
298214
"source": [
299215
"## Validate that the asset is loadable\n",
@@ -305,25 +221,10 @@
305221
},
306222
{
307223
"cell_type": "code",
308-
"execution_count": 7,
309-
"id": "validate",
310-
"metadata": {
311-
"execution": {
312-
"iopub.execute_input": "2026-06-04T23:13:12.484574Z",
313-
"iopub.status.busy": "2026-06-04T23:13:12.484499Z",
314-
"iopub.status.idle": "2026-06-04T23:13:12.498350Z",
315-
"shell.execute_reply": "2026-06-04T23:13:12.497839Z"
316-
}
317-
},
318-
"outputs": [
319-
{
320-
"name": "stdout",
321-
"output_type": "stream",
322-
"text": [
323-
"OK\n"
324-
]
325-
}
326-
],
224+
"execution_count": null,
225+
"id": "15",
226+
"metadata": {},
227+
"outputs": [],
327228
"source": [
328229
"reloaded = AIModelAsset.load(asset_path)\n",
329230
"async with reloaded.executable() as model:\n",

0 commit comments

Comments
 (0)