|
12 | 12 | "\n", |
13 | 13 | "The Laplace and Banana sources are described in:\n", |
14 | 14 | "\n", |
15 | | - "\u003e \"Nonlinear Transform Coding\"\u003cbr /\u003e\n", |
16 | | - "\u003e J. Ballé, P. A. Chou, D. Minnen, S. Singh, N. Johnston, E. Agustsson, S. J. Hwang, G. Toderici\u003cbr /\u003e\n", |
17 | | - "\u003e https://arxiv.org/abs/2007.03034\n", |
| 15 | + "> \"Nonlinear Transform Coding\"<br />\n", |
| 16 | + "> J. Ballé, P. A. Chou, D. Minnen, S. Singh, N. Johnston, E. Agustsson, S. J. Hwang, G. Toderici<br />\n", |
| 17 | + "> https://arxiv.org/abs/2007.03034\n", |
18 | 18 | "\n", |
19 | 19 | "The Sawbridge process is described in:\n", |
20 | 20 | "\n", |
21 | | - "\u003e \"Neural Networks Optimally Compress the Sawbridge\"\u003cbr /\u003e\n", |
22 | | - "\u003e A. B. Wagner, J. Ballé\u003cbr /\u003e\n", |
23 | | - "\u003e https://arxiv.org/abs/2011.05065\n", |
| 21 | + "> \"Neural Networks Optimally Compress the Sawbridge\"<br />\n", |
| 22 | + "> A. B. Wagner, J. Ballé<br />\n", |
| 23 | + "> https://arxiv.org/abs/2011.05065\n", |
24 | 24 | "\n", |
25 | 25 | "This notebook requires TFC v2 (`pip install tensorflow-compression==2.*`)\n" |
26 | 26 | ] |
27 | 27 | }, |
28 | 28 | { |
29 | 29 | "cell_type": "code", |
| 30 | + "execution_count": null, |
30 | 31 | "metadata": { |
31 | 32 | "cellView": "form", |
32 | 33 | "id": "wdA5NUZ-fSxG" |
33 | 34 | }, |
| 35 | + "outputs": [], |
34 | 36 | "source": [ |
35 | 37 | "#@title Dependencies for Colab\n", |
36 | 38 | "\n", |
|
43 | 45 | "# Downloads the 'models' directory from Github.\n", |
44 | 46 | "![[ -e /tfc ]] || git clone https://github.com/tensorflow/compression /tfc\n", |
45 | 47 | "%cd /tfc/models\n" |
46 | | - ], |
47 | | - "execution_count": null, |
48 | | - "outputs": [] |
| 48 | + ] |
49 | 49 | }, |
50 | 50 | { |
51 | 51 | "cell_type": "code", |
|
322 | 322 | " # Estimate KLT from samples.\n", |
323 | 323 | " eigv, error = estimate_klt(\n", |
324 | 324 | " source, tf.constant(num_samples), tf.constant(latent_dims))\n", |
325 | | - " assert error \u003c tolerance, error.numpy()\n", |
| 325 | + " assert error < tolerance, error.numpy()\n", |
326 | 326 | " eigv = tf.cast(eigv, dtype)\n", |
327 | 327 | "\n", |
328 | 328 | " analysis = tf.keras.Sequential([\n", |
|
417 | 417 | " \"\"\"Returns a learning rate scheduler function for the given configuration.\"\"\"\n", |
418 | 418 | " def scheduler(epoch, lr):\n", |
419 | 419 | " del lr # unused\n", |
420 | | - " if epoch \u003c warmup_epochs:\n", |
| 420 | + " if epoch < warmup_epochs:\n", |
421 | 421 | " return learning_rate * 10. ** (epoch - warmup_epochs)\n", |
422 | | - " if epoch \u003c 1/2 * epochs:\n", |
| 422 | + " if epoch < 1/2 * epochs:\n", |
423 | 423 | " return learning_rate\n", |
424 | | - " if epoch \u003c 3/4 * epochs:\n", |
| 424 | + " if epoch < 3/4 * epochs:\n", |
425 | 425 | " return learning_rate * 1e-1\n", |
426 | | - " if epoch \u003c 7/8 * epochs:\n", |
| 426 | + " if epoch < 7/8 * epochs:\n", |
427 | 427 | " return learning_rate * 1e-2\n", |
428 | 428 | " return learning_rate * 1e-3\n", |
429 | 429 | " return scheduler\n", |
|
456 | 456 | "def get_alpha_scheduler(epochs):\n", |
457 | 457 | " \"\"\"Returns an alpha scheduler function for the given configuration.\"\"\"\n", |
458 | 458 | " def scheduler(epoch):\n", |
459 | | - " if epoch \u003c 1/4 * epochs:\n", |
| 459 | + " if epoch < 1/4 * epochs:\n", |
460 | 460 | " return 3. * (epoch + 1) / (epochs/4 + 1)\n", |
461 | 461 | " return None\n", |
462 | 462 | " return scheduler\n" |
|
1160 | 1160 | " callbacks=tf.keras.callbacks.CallbackList(callback_list, model=model),\n", |
1161 | 1161 | ")\n" |
1162 | 1162 | ] |
1163 | | - }, |
1164 | | - { |
1165 | | - "cell_type": "code", |
1166 | | - "execution_count": null, |
1167 | | - "metadata": { |
1168 | | - "id": "TmK8AWxQRl6E" |
1169 | | - }, |
1170 | | - "outputs": [], |
1171 | | - "source": [ |
1172 | | - "" |
1173 | | - ] |
1174 | 1163 | } |
1175 | 1164 | ], |
1176 | 1165 | "metadata": { |
|
1180 | 1169 | "cVgn8T6pySgP", |
1181 | 1170 | "KmoKt709KFAv" |
1182 | 1171 | ], |
1183 | | - "last_runtime": { |
1184 | | - "build_target": "", |
1185 | | - "kind": "local" |
1186 | | - }, |
1187 | | - "name": "toy_sources.ipynb" |
| 1172 | + "name": "toy_sources.ipynb", |
| 1173 | + "toc_visible": true |
1188 | 1174 | }, |
1189 | 1175 | "kernelspec": { |
1190 | 1176 | "display_name": "Python 3", |
|
0 commit comments