Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
a73c656a
"tests/vscode:/vscode.git/clone" did not exist on "e5464ee484450c2671dd0226516c99c60ce70d9d"
Commit
a73c656a
authored
Jul 13, 2018
by
Mark Daoust
Browse files
Add clarifications from discussion with @mdanatg
parent
fceeb46d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
131 deletions
+28
-131
samples/core/guide/autograph.ipynb
samples/core/guide/autograph.ipynb
+28
-131
No files found.
samples/core/guide/autograph.ipynb
View file @
a73c656a
...
...
@@ -5,8 +5,6 @@
"colab": {
"name": "autograph.ipynb",
"version": "0.3.2",
"views": {},
"default_view": {},
"provenance": [],
"private_outputs": true,
"collapsed_sections": [
...
...
@@ -36,12 +34,7 @@
"metadata": {
"id": "llMNufAK7nfK",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -116,12 +109,7 @@
"metadata": {
"id": "RSez0n7Ptcvb",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -144,12 +132,7 @@
"metadata": {
"id": "mT7meGqrZTz9",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -177,12 +160,7 @@
"metadata": {
"id": "ks_hiqcSJNvg",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -217,12 +195,7 @@
"metadata": {
"id": "aA3gOodCBkOw",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -250,12 +223,7 @@
"metadata": {
"id": "_EMhGUjRZoKQ",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -278,12 +246,7 @@
"metadata": {
"id": "I1RtBvoKBxq5",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -306,12 +269,7 @@
"metadata": {
"id": "SGjSq0WQvwGs",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -342,12 +300,7 @@
"metadata": {
"id": "toxKBOXbB1ro",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -375,12 +328,7 @@
"metadata": {
"id": "jlyQgxYsYSXr",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -405,12 +353,7 @@
"metadata": {
"id": "BKhFNXDic4Mw",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -467,12 +410,7 @@
"metadata": {
"id": "IAOgh62zCPZ4",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -507,12 +445,7 @@
"metadata": {
"id": "ySTsuxnqCTQi",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -547,12 +480,7 @@
"metadata": {
"id": "ABX070KwCczR",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -591,12 +519,7 @@
"metadata": {
"id": "4yyNOf-Twr6s",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -631,12 +554,7 @@
"metadata": {
"id": "ucmZyQVL03bF",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -667,12 +585,7 @@
"metadata": {
"id": "1sjaFcL717Ig",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -728,12 +641,7 @@
"metadata": {
"id": "xqoxumv0ssQW",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -756,12 +664,7 @@
"metadata": {
"id": "Pe-erWQdBoC5",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -786,6 +689,9 @@
"\n",
"def fit(m, x, y, opt):\n",
" l, accuracy = predict(m, x, y)\n",
" # Autograph automatically adds the necessary `tf.control_dependencies` here.\n",
" # (Without them nothing depends on `opt.minimize`, so it doesn't run.)\n",
" # This makes it much more like eager-code.\n",
" opt.minimize(l)\n",
" return l, accuracy\n",
"\n",
...
...
@@ -826,15 +732,12 @@
"metadata": {
"id": "3xtg_MMhJETd",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
"# Use `recursive = True` to recursively convert functions called by this one.\n",
"@autograph.convert(recursive=True)\n",
"def train(train_ds, test_ds, hp):\n",
" m = mlp_model((28 * 28,))\n",
" opt = tf.train.MomentumOptimizer(hp.learning_rate, 0.9)\n",
...
...
@@ -893,12 +796,7 @@
"metadata": {
"id": "HYh6MSZyJOag",
"colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
}
"colab": {}
},
"cell_type": "code",
"source": [
...
...
@@ -909,9 +807,8 @@
" )\n",
" train_ds = setup_mnist_data(True, 50)\n",
" test_ds = setup_mnist_data(False, 1000)\n",
" tf_train = autograph.to_graph(train)\n",
" (train_losses, test_losses, train_accuracies,\n",
" test_accuracies) =
tf_
train(train_ds, test_ds, hp)\n",
" test_accuracies) = train(train_ds, test_ds, hp)\n",
"\n",
" init = tf.global_variables_initializer()\n",
" \n",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment