Skip to content

Instantly share code, notes, and snippets.

@RaphaelMeudec
Created January 16, 2020 13:32
Show Gist options
  • Save RaphaelMeudec/dee851b27bf9eec1eae473ed3bf58bd6 to your computer and use it in GitHub Desktop.
Save RaphaelMeudec/dee851b27bf9eec1eae473ed3bf58bd6 to your computer and use it in GitHub Desktop.
# Define multi-gpu strategy
mirrored_strategy = tf.distribute.MirroredStrategy()
# Update batch size value
batch_size *= mirrored_strategy.num_replicas_in_sync
# Create strategy scope to perform training
with mirrored_strategy.scope():
model = [...]
model.fit(...)
@vchitnis
Copy link

vchitnis commented Feb 12, 2020

Is the model.fit(...) called within the scope of
with mirrored_strategy.scope():
or outside of it?

@SijRa
Copy link

SijRa commented Feb 20, 2020

Is the model.fit(...) called within the scope of
with mirrored_strategy.scope():
or outside of it?

It is called within the scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment