Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitgr7 committed Nov 9, 2021
1 parent c2a3626 commit be5882c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ def __repr__(self) -> str:

def __getstate__(self, drop_value: bool = True) -> dict:
d = self.__dict__.copy()
del d["_current_batch"]
# all the items should be either `ResultMetric`s or `ResultMetricCollection`s
items = {k: v.__getstate__(drop_value=drop_value) for k, v in self.items()}
return {**d, "items": items}
Expand Down
1 change: 0 additions & 1 deletion tests/loops/batch/test_truncated_bptt.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def configure_optimizers(self):

def training_step(self, batch, batch_idx, hiddens):
x, y = batch
breakpoint()
pred, hiddens = self.lstm(x, hiddens)
loss = F.mse_loss(pred, y)
return {"loss": loss, "hiddens": hiddens}
Expand Down
5 changes: 0 additions & 5 deletions tests/loops/test_loop_state_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from unittest.mock import Mock

import pytest
import torch

from pytorch_lightning.loops import FitLoop
from pytorch_lightning.trainer.trainer import Trainer
Expand Down Expand Up @@ -81,13 +80,11 @@ def test_loops_state_dict_structure():
},
"epoch_loop.val_loop._results": {
"training": False,
"_batch_size": torch.tensor(1),
"device": None,
"items": {},
},
"epoch_loop._results": {
"training": True,
"_batch_size": torch.tensor(1),
"device": None,
"items": {},
},
Expand All @@ -107,7 +104,6 @@ def test_loops_state_dict_structure():
},
"_results": {
"training": False,
"_batch_size": torch.tensor(1),
"device": None,
"items": {},
},
Expand All @@ -123,7 +119,6 @@ def test_loops_state_dict_structure():
},
"_results": {
"training": False,
"_batch_size": torch.tensor(1),
"device": None,
"items": {},
},
Expand Down

0 comments on commit be5882c

Please sign in to comment.