Created
August 17, 2019 01:22
-
-
Save rish-16/936399fc7d4516c8a0fcf15b47d1c59a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Select appropriate distribution strategy | |
| if tpu: | |
| tf.tpu.experimental.initialize_tpu_system(tpu) | |
| strategy = tf.distribute.experimental.TPUStrategy(tpu, steps_per_run=128) | |
| print('Running on TPU ', tpu.cluster_spec().as_dict()['worker']) | |
| else: | |
| strategy = tf.distribute.get_strategy() # Default strategy that works on CPU and single GPU | |
| print('Running on CPU instead') | |
| print("Number of accelerators: ", strategy.num_replicas_in_sync) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment