Skip to content

Instantly share code, notes, and snippets.

@miki998
Created April 14, 2020 07:18
Show Gist options
  • Save miki998/abeed6d8d10f58441ad02dc28045bdf1 to your computer and use it in GitHub Desktop.
Save miki998/abeed6d8d10f58441ad02dc28045bdf1 to your computer and use it in GitHub Desktop.
train_x = torch.from_numpy(X_train).float()
train_y = torch.from_numpy(targets_train).long()
test_x = torch.from_numpy(X_test).float()
test_y = torch.from_numpy(targets_test).long()
batch_size = 100 #We pick beforehand a batch_size that we will use for the training
# Pytorch train and test sets
train = torch.utils.data.TensorDataset(train_x,train_y)
test = torch.utils.data.TensorDataset(test_x,test_y)
# data loader
train_loader = torch.utils.data.DataLoader(train, batch_size = batch_size, shuffle = False)
test_loader = torch.utils.data.DataLoader(test, batch_size = batch_size, shuffle = False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment