(dataset, sample_size=None, batch_size=10, sampler=None,
        **kwargs)
return torch.utils.data.DataLoader(
            dataset,
            sampler=sampler,
            batch_size=batch_size,
            **kwargs)
Utility for creating a dataloader on fixed sample subset.
Utility for creating a dataloader on fixed sample subset.
Utility for creating a dataloader on fixed sample subset .
def make_loader(dataset, sample_size=None, batch_size=10, sampler=None,
        **kwargs):
    '''Utility for creating a dataloader on fixed sample subset.'''
    if isinstance(dataset, torch.Tensor):
        dataset = torch.utils.data.TensorDataset(dataset)
    if sampler is None:
        if sample_size is not None:
            if sample_size > len(dataset):
                pbar.print("Warning: sample size %d > dataset size %d" %
                        (sample_size, len(dataset)))
                sample_size = len(dataset)
            sampler = FixedSubsetSampler(list(range(sample_size)))
    return torch.utils.data.DataLoader(
            dataset,
            sampler=sampler,
            batch_size=batch_size,
            **kwargs)
def make_loader ( dataset , sample_size = None , batch_size = 10 , sampler = None , * * kwargs ) : if isinstance ( dataset , torch . Tensor ) : dataset = torch . utils . data . TensorDataset ( dataset ) if sampler is None : if sample_size is not None : if sample_size > len ( dataset ) : pbar . print ( "Warning: sample size %d > dataset size %d" % ( sample_size , len ( dataset ) ) ) sample_size = len ( dataset ) sampler = FixedSubsetSampler ( list ( range ( sample_size ) ) ) return torch . utils . data . DataLoader ( dataset , sampler = sampler , batch_size = batch_size , * * kwargs )