You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we do self.log('loss', loss, sync_dist=True) in a LightningModule, is the loss averaged or summed across all the GPUs? From my experiments it seems to be averaged, but it would be nice if the documentation can confirm this explicitly. Currently it says "reduces the metric across devices" but does not mention anything about the reduction operation.
Edit: Upon further investigation, the default reduction operation used by self.log seems to be trainer.strategy.reduce (module.py, line 534). At least for DDPStrategy, this indeed defaults to a mean reduction.
📚 Documentation
If we do
self.log('loss', loss, sync_dist=True)
in aLightningModule
, is theloss
averaged or summed across all the GPUs? From my experiments it seems to be averaged, but it would be nice if the documentation can confirm this explicitly. Currently it says "reduces the metric across devices" but does not mention anything about the reduction operation.Edit: Upon further investigation, the default reduction operation used by
self.log
seems to betrainer.strategy.reduce
(module.py, line 534). At least forDDPStrategy
, this indeed defaults to a mean reduction.cc @lantiga @Borda
The text was updated successfully, but these errors were encountered: