2020-04-16 02:16:40 +00:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
2020-05-05 16:31:15 +00:00
|
|
|
from tests.base.eval_model_utils import CustomInfDataloader
|
|
|
|
|
2020-04-16 02:16:40 +00:00
|
|
|
|
|
|
|
class TrainDataloaderVariations(ABC):
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def dataloader(self, train: bool):
|
|
|
|
"""placeholder"""
|
|
|
|
|
|
|
|
def train_dataloader(self):
|
|
|
|
return self.dataloader(train=True)
|
2020-05-05 16:31:15 +00:00
|
|
|
|
|
|
|
def train_dataloader__infinite(self):
|
|
|
|
return CustomInfDataloader(self.dataloader(train=True))
|
|
|
|
|
|
|
|
def train_dataloader__zero_length(self):
|
|
|
|
dataloader = self.dataloader(train=True)
|
|
|
|
dataloader.dataset.data = dataloader.dataset.data[:0]
|
|
|
|
dataloader.dataset.targets = dataloader.dataset.targets[:0]
|
|
|
|
return dataloader
|