STT-tensorflow/tensorflow/examples/tf2_showcase
Hye Soo Yang d710569548 PY3 migration - Set py targets to "PY3" in third_party/tensorflow/...
PiperOrigin-RevId: 284874116
Change-Id: I65a79643242b127f014f5eb5f175ac2b28602ce7
2019-12-10 16:30:21 -08:00
..
BUILD PY3 migration - Set py targets to "PY3" in third_party/tensorflow/... 2019-12-10 16:30:21 -08:00
mnist.py
README.md MNIST TF 2.0 integration test 2018-11-07 16:03:33 -08:00

TF 2.0 Showcase

The code here shows idiomatic ways to write TensorFlow 2.0 code. It doubles as an integration test.

General guidelines for showcase code:

  • Code should minimize dependencies and be self-contained in one file. A user should be able to copy-paste the example code into their project and have it just work.

  • Code should emphasize simplicity over performance, as long as it performs within a factor of 2-3x of the optimized implementation.

  • Code should work on CPU and single GPU.

  • Code should run in Python 3.

  • Code should conform to the Google Python Style Guide

  • Code should follow these guidelines:

    • Prefer Keras.
    • Split code into separate input pipeline and model code segments.
    • Don't use tf.cond or tf.while_loop; instead, make use of AutoGraph's functionality to compile Python for, while, and if statements.
    • Prefer a simple training loop over Estimator
    • Save and restore a SavedModel.
    • Write basic TensorBoard metrics - loss, accuracy,