From f5a354fdb05fca54f60090be3d65099b29fccc2a Mon Sep 17 00:00:00 2001 From: Jake Austin Date: Sun, 17 Jul 2022 22:48:46 -0700 Subject: [PATCH] Patching up some mistakes, linting --- pyrad/data/dataloader.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pyrad/data/dataloader.py b/pyrad/data/dataloader.py index ebf310378..50f97171e 100644 --- a/pyrad/data/dataloader.py +++ b/pyrad/data/dataloader.py @@ -86,23 +86,23 @@ def setup_dataset_eval(config: DataConfig, test_mode: bool, device: str) -> Tupl class IterableWrapper: - """A helper that will allow a class to return multiple kinds of iterables. + """A helper that will allow an instance of a class to return multiple kinds of iterables bound to different functions of that class. - To use this, pass in the instance of the class you want to have multiple kinds of iterables for, and pass in the - class method that you want to be the __next__() method of the iterable. The resulting instantiated object will + To use this, pass in the instance of the class you want to have multiple kinds of iterables for, and pass in a + method belonging to that class that you want to be the __next__() method of the iterable. The resulting instantiated object will be an iterable that will use the passed in class method as the __next__() method.""" - def __init__(self, instance: object, next: callable): + def __init__(self, instance: object, new_next: callable): """ Args: - instance (type): instance class we are wrapping - next (callable): function that will be called instead as the __next__() + instance (object): instance class we are wrapping + new_next (callable): function that will be called instead as the __next__() """ self.instance = instance - self.next = next + self.new_next = new_next def __next__(self): - return self.next(self.instance) + return self.new_next(self.instance) class AbstractDataloaderV2(nn.Module): @@ -171,7 +171,7 @@ class AbstractDataloaderV2(nn.Module): def iter_eval(self) -> IterableWrapper: """Returns an iterator that executes the self.next_eval function""" - self.train_count = 0 + self.eval_count = 0 return IterableWrapper(self, self.next_eval) @abstractmethod