Skip to content

Commit 1f9cdb7

Browse files
author
Christopher Doris
committed
update flux example
1 parent 91e8662 commit 1f9cdb7

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

examples/flux.ipynb

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
{
44
"cell_type": "code",
55
"execution_count": null,
6-
"id": "assisted-police",
6+
"id": "3af41f01",
77
"metadata": {},
88
"outputs": [],
99
"source": [
1010
"import numpy as np, matplotlib.pyplot as plt\n",
11-
"from juliacall import Main as jl"
11+
"from juliacall import Main as jl, convert as jlconvert"
1212
]
1313
},
1414
{
1515
"cell_type": "code",
1616
"execution_count": null,
17-
"id": "minus-classroom",
17+
"id": "b04d1a1f",
1818
"metadata": {},
1919
"outputs": [],
2020
"source": [
@@ -27,7 +27,7 @@
2727
{
2828
"cell_type": "code",
2929
"execution_count": null,
30-
"id": "lovely-reception",
30+
"id": "0e8c14ae",
3131
"metadata": {},
3232
"outputs": [],
3333
"source": [
@@ -44,22 +44,22 @@
4444
{
4545
"cell_type": "code",
4646
"execution_count": null,
47-
"id": "marked-monitoring",
47+
"id": "acec7450",
4848
"metadata": {},
4949
"outputs": [],
5050
"source": [
5151
"jl.Flux.train_b(\n",
5252
" loss,\n",
5353
" jl.Flux.params(model),\n",
54-
" jl.Vector[jl.Tuple]([batch(100) for _ in range(2000)]),\n",
54+
" jlconvert(jl.Vector[jl.Tuple], [batch(100) for _ in range(2000)]),\n",
5555
" jl.ADAM(0.01),\n",
5656
")"
5757
]
5858
},
5959
{
6060
"cell_type": "code",
6161
"execution_count": null,
62-
"id": "exciting-angola",
62+
"id": "85331980",
6363
"metadata": {},
6464
"outputs": [],
6565
"source": [
@@ -70,11 +70,19 @@
7070
"plt.legend()\n",
7171
"print(\"loss =\", loss(x,y))"
7272
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": null,
77+
"id": "7bbc27c9",
78+
"metadata": {},
79+
"outputs": [],
80+
"source": []
7381
}
7482
],
7583
"metadata": {
7684
"kernelspec": {
77-
"display_name": "Python 3",
85+
"display_name": "Python 3 (ipykernel)",
7886
"language": "python",
7987
"name": "python3"
8088
},
@@ -88,7 +96,7 @@
8896
"name": "python",
8997
"nbconvert_exporter": "python",
9098
"pygments_lexer": "ipython3",
91-
"version": "3.6.10"
99+
"version": "3.10.5"
92100
}
93101
},
94102
"nbformat": 4,

examples/flux.png

-23.5 KB
Loading

0 commit comments

Comments
 (0)