Logging metrics with compute() #6223
Answered
by
SkafteNicki
ss007k
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
-
Trying to understand compute() for logging. Could someone please tell if the self.log(train_acc..., on_epoch=True) is same as def training_epoch_end() which uses compute - code below
|
Beta Was this translation helpful? Give feedback.
Answered by
SkafteNicki
Mar 3, 2021
Replies: 1 comment 1 reply
-
Yes, its the same. Here is the relevant code: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ss007k
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, its the same. Here is the relevant code:
https://github.com/PyTorchLightning/pytorch-lightning/blob/4a8422c2dc870d29d26748e6aa01406d2e74fa48/pytorch_lightning/core/step_result.py#L325-L330
Setting
on_epoch=True
will essentially callmetric.compute
at the end of the epoch.