Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed a bug that caused incorrect batch indices to be passed to the `BasePredictionWriter` hooks when using a dataloader with `num_workers > 0` ([#10870](https://github.com/PyTorchLightning/pytorch-lightning/pull/10870))


-
- Fixed an issue with item assignment on the logger on rank > 0 for those who support it ([#10917](https://github.com/PyTorchLightning/pytorch-lightning/pull/10917))



Expand Down
3 changes: 3 additions & 0 deletions pytorch_lightning/loggers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ def __getitem__(self, idx) -> "DummyExperiment":
# enables self.logger.experiment[0].add_image(...)
return self

def __setitem__(self, *args, **kwargs) -> None:
pass


class DummyLogger(LightningLoggerBase):
"""Dummy logger for internal use.
Expand Down
7 changes: 7 additions & 0 deletions tests/loggers/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ def test_dummylogger_noop_method_calls():
logger.log_metrics("1", 2, three="three")


def test_dummyexperiment_support_item_assignment():
"""Test that the DummyExperiment supports item assignment."""
experiment = DummyExperiment()
experiment["variable"] = "value"
assert experiment["variable"] != "value" # this is only a stateless mock experiment


def test_np_sanitization():
class CustomParamsLogger(CustomLogger):
def __init__(self):
Expand Down