-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize iterator only once per fit call (#835)
At the moment, we initialize the iterators for the training and validation datasets once per epoch. However, this is unnecessary and creates an (ever so small) overhead. With this PR, the iterators are created once per fit call only. A provision was added to keep backwards compatibility, but a DeprecationWarning will be raised with instructions on how to change the code. To test the change in terms of performance, I ran the MNIST benchmark. (While doing so, I fixed a few issues with the script.). The difference of this PR on this benchmark is not noticeable. I would only expect a performance difference on very small datasets. Still, I believe the benefits outweigh the costs. Side note: The test_pickle_load failed for me locally when cuda_available was set to False. I'm not exactly sure what the reason is, it could be that the way we patch torch.cuda.is_available breaks with some recent changes in PyTorch.
- Loading branch information
1 parent
c58ae67
commit f5bb1a5
Showing
6 changed files
with
145 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters