Last active
June 22, 2020 16:07
-
-
Save Mehdi-Amine/cee37506ecdcd081a16783343772c9a7 to your computer and use it in GitHub Desktop.
creating data loader to feed data to the network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch.utils.data import TensorDataset | |
from torch.utils.data import DataLoader | |
# Converting from numpy arrays to torch tensors | |
x_train = torch.from_numpy(train_set_std[:,:-1]).float() | |
y_train = torch.from_numpy(train_set_std[:,-1]).long() | |
# Creating tensor-datasets | |
train_ds = TensorDataset(x_train, y_train) | |
# Creating data-loaders | |
batch_size = 32 | |
train_dl = DataLoader(train_ds, batch_size=batch_size) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment