File size: 571 Bytes
5e811f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Import Libaries
from torch.utils.data import DataLoader, TensorDataset

# Map target and label data together in a tuple format
def preprocess_data(label_X, target_y):
    preprocessed= TensorDataset(label_X, target_y)
    return preprocessed

# Create data loaders
def dataloader(dataset, batch_size, shuffle, num_workers):
    dataloader= DataLoader(dataset=dataset,
                           batch_size=batch_size,
                           shuffle= shuffle,
                           num_workers=num_workers,
                           )
    return (dataloader)