MCPcopy Create free account
hub / github.com/MaureenZOU/TSAM / __init__

Method __init__

src/base/base_data_loader.py:11–27  ·  view source on GitHub ↗
(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate)

Source from the content-addressed store, hash-verified

9 Base class for all data loaders
10 """
11 def __init__(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate):
12 self.validation_split = validation_split
13 self.shuffle = shuffle
14
15 self.batch_idx = 0
16 self.n_samples = len(dataset)
17
18 self.sampler, self.valid_sampler = self._split_sampler(self.validation_split)
19
20 self.init_kwargs = {
21 'dataset': dataset,
22 'batch_size': batch_size,
23 'shuffle': self.shuffle,
24 'collate_fn': collate_fn,
25 'num_workers': num_workers
26 }
27 super(BaseDataLoader, self).__init__(sampler=self.sampler, **self.init_kwargs)
28
29 def _split_sampler(self, split):
30 if split == 0.0:

Callers

nothing calls this directly

Calls 1

_split_samplerMethod · 0.95

Tested by

no test coverage detected