NanoTorch
NanoTorch copied to clipboard
Add `Dataset` and `DataLoader`.
Issue Description:
Adding Dataset and DataLoader for neuranet, These classes are fundamental for organizing and managing data efficiently.
1. Dataset Class:
The `Dataset class will serve as an abstract base class, defining a structure for organizing and managing data. It is mandatory for any custom dataset to implement a logic for retrieving elements by index.
2. DataLoader Class:
The DataLoader class will be responsible for creating an iterator over a given dataset. It will handle loading and batching the data, with an additional option to shuffle the data.
class DataLoader:
def __init__(self, dataset, batch_size=1, shuffle=False):
...
def __iter__(self):
....
custom_dataset = CustomDataset() # Instantiate your custom dataset
loader = DataLoader(custom_dataset, batch_size=64, shuffle=True)
for x, y in loader:
...