b7920b1c847a5cdbe4728263fda80307fc6b6524,pytorch_lightning/trainer/connectors/logger_connector/epoch_result_store.py,HookResultStore,auto_reduce_results_on_epoch_end,#HookResultStore#,176
Before Change
// Make sure we didn"t create key
assert num_opt_idx >= 0
for opt_idx in range(num_opt_idx + 1):
// TODO: Figure out to reduce memory
// TODO: How to start training in middle of epoch
opt_outputs = epoch_metrics[opt_idx]
// reduce across time first
time_reduced_outputs = []
for batch_idx in opt_outputs.keys():
tbptt_outs = opt_outputs[batch_idx]
tbptt_outs = tbptt_outs[0].__class__.reduce_across_time(tbptt_outs)
if len(tbptt_outs) > 1:
time_reduced_outputs.append(tbptt_outs)
if len(time_reduced_outputs) == 0:
continue
// reduce across training steps
opt_outputs = time_reduced_outputs[0].__class__.reduce_on_epoch_end(time_reduced_outputs)
// with manual opt need 1 + metrics because meta is always there
if opt_outputs.minimize is not None:
opt_outputs.minimize = opt_outputs.minimize.mean()
self._internals_reduced[dl_idx][opt_idx] = opt_outputs
// free memory
del self._internals[dl_idx][opt_idx]
else:
// no need to reduce as called only once
if len(epoch_metrics) == 1:
reduced_epoch_metrics = epoch_metrics[0]
After Change
epoch_metrics = self._internals[dl_idx]
if self._internal_type == ResultStoreType.INSIDE_BATCH_TRAIN_LOOP:
for opt_idx in list(epoch_metrics) :
// TODO: Figure out to reduce memory
// TODO: How to start training in middle of epoch
opt_outputs = epoch_metrics[opt_idx]
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: williamFalcon/pytorch-lightning
Commit Name: b7920b1c847a5cdbe4728263fda80307fc6b6524
Time: 2021-02-03
Author: carlossmocholi@gmail.com
File Name: pytorch_lightning/trainer/connectors/logger_connector/epoch_result_store.py
Class Name: HookResultStore
Method Name: auto_reduce_results_on_epoch_end
Project Name: PetrochukM/PyTorch-NLP
Commit Name: dd2eaf6c174fdd757514bc06d1063e5f9c6bb4a0
Time: 2019-10-20
Author: petrochukm@gmail.com
File Name: torchnlp/samplers/bucket_batch_sampler.py
Class Name: BucketBatchSampler
Method Name: __iter__
Project Name: shenweichen/DeepCTR
Commit Name: 2d720403e43ccbf2286c99876ce3bb8a9286f5c6
Time: 2020-03-15
Author: wcshen1994@163.com
File Name: deepctr/layers/interaction.py
Class Name: FieldWiseBiInteraction
Method Name: call