Skip to content

Commit

Permalink
Add trainer attribute to datamodule (#3749)
Browse files Browse the repository at this point in the history
* Split out changes from #3563 to make that PR easier to review. This formats the file according to the Black formatter

* Store a reference to the trainer on the datamodule

Fixes #3682

* Update data_connector.py

* Update data_connector.py

* Update test_datamodules.py

* Add attribute to datamodule for trainer
  • Loading branch information
ananthsub authored Sep 30, 2020
1 parent d3ae26f commit 1eb1d17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pytorch_lightning/core/datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def __init__(
self._test_transforms = test_transforms
self._dims = dims if dims is not None else ()

# Pointer to the trainer object
self.trainer = None

# Private attrs to keep track of whether or not data hooks have been called yet
self._has_prepared_data = False
self._has_setup_fit = False
Expand Down

0 comments on commit 1eb1d17

Please sign in to comment.