Skip to content

Commit

Permalink
integrate #7736
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed May 27, 2021
1 parent ccd738b commit 395050a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pytorch_lightning/loops/batch_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from torch.optim import Optimizer

from pytorch_lightning.core.optimizer import LightningOptimizer
from pytorch_lightning.core.step_result import Result
from pytorch_lightning.loops.base import Loop
from pytorch_lightning.plugins import ParallelPlugin
from pytorch_lightning.trainer.connectors.logger_connector.result import Result
from pytorch_lightning.trainer.supporters import TensorRunningAccum
from pytorch_lightning.utilities import AMPType, AttributeDict, DeviceType, grad_norm
from pytorch_lightning.utilities.exceptions import MisconfigurationException
Expand Down Expand Up @@ -179,9 +179,9 @@ def training_step_and_backward_closure(
return_result: AttributeDict,
) -> Optional[torch.Tensor]:

step_result = self.training_step_and_backward(split_batch, batch_idx, opt_idx, optimizer, hiddens)
if step_result is not None:
return_result.update(step_result)
result = self.training_step_and_backward(split_batch, batch_idx, opt_idx, optimizer, hiddens)
if result is not None:
return_result.update(result)
return return_result.loss

def make_closure(self, *closure_args, **closure_kwargs: Any) -> Callable:
Expand Down
1 change: 0 additions & 1 deletion pytorch_lightning/loops/epoch_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import pytorch_lightning as pl
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
from pytorch_lightning.core.step_result import Result
from pytorch_lightning.loops.base import Loop
from pytorch_lightning.loops.training_loop import TrainingLoop
from pytorch_lightning.trainer.supporters import TensorRunningAccum
Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/loops/evaluation_dataloader_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from torch.utils.data.dataloader import DataLoader

from pytorch_lightning.core.step_result import Result
from pytorch_lightning.loops.base import Loop
from pytorch_lightning.loops.evaluation_loop import EvaluationLoop
from pytorch_lightning.trainer.connectors.logger_connector.result import Result
from pytorch_lightning.trainer.states import TrainerFn
from pytorch_lightning.trainer.supporters import PredictionCollection
from pytorch_lightning.utilities.model_helpers import is_overridden
Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/loops/evaluation_loop.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from collections import OrderedDict
from typing import Any, Optional, Dict, Union, Iterator

from pytorch_lightning.core.step_result import Result
from pytorch_lightning.loops.base import Loop
from pytorch_lightning.trainer.connectors.logger_connector.result import Result
from pytorch_lightning.trainer.supporters import PredictionCollection
from pytorch_lightning.utilities.types import STEP_OUTPUT

Expand Down
2 changes: 1 addition & 1 deletion pytorch_lightning/loops/training_loop.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Dict, List, Union

import pytorch_lightning as pl
from pytorch_lightning.core.step_result import Result
from pytorch_lightning.loops.base import Loop
from pytorch_lightning.loops.batch_loop import BatchLoop
from pytorch_lightning.trainer.connectors.logger_connector.result import Result
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from pytorch_lightning.utilities.model_helpers import is_overridden
from pytorch_lightning.utilities.signature_utils import is_param_in_hook_signature
Expand Down

0 comments on commit 395050a

Please sign in to comment.