Skip to content

Instantly share code, notes, and snippets.

@hristian-carabulea
Forked from jzuern/convert-keras-model.py
Created October 29, 2019 17:45
Show Gist options
  • Save hristian-carabulea/b6f8839322401b8f4018e028f7e9f171 to your computer and use it in GitHub Desktop.
Save hristian-carabulea/b6f8839322401b8f4018e028f7e9f171 to your computer and use it in GitHub Desktop.
# This address identifies the TPU we'll use when configuring TensorFlow.
TPU_WORKER = 'grpc://' + os.environ['COLAB_TPU_ADDR']
tf.logging.set_verbosity(tf.logging.INFO)
resnet_model = tf.contrib.tpu.keras_to_tpu_model(
resnet_model,
strategy=tf.contrib.tpu.TPUDistributionStrategy(
tf.contrib.cluster_resolver.TPUClusterResolver(TPU_WORKER)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment