Skip to content

Instantly share code, notes, and snippets.

@piEsposito
Last active April 28, 2020 17:42
Show Gist options
  • Save piEsposito/88cf92386ae153b6a876e8ecb6ebb4e7 to your computer and use it in GitHub Desktop.
Save piEsposito/88cf92386ae153b6a876e8ecb6ebb4e7 to your computer and use it in GitHub Desktop.
padded_dataset = []
for i in tqdm(range(len(reviews))):
padded_dataset.append(pad_tensor(reviews[i], int(max_pad_length)))
X = torch.stack(padded_dataset)
y = torch.tensor(labels)
#train test splitting
X_train, X_test, y_train, y_test = train_test_split(X,
y,
test_size=.25,
random_state=42)
X_train, y_train = torch.tensor(X_train), torch.tensor(y_train)
X_test, y_test = torch.tensor(X_test), torch.tensor(y_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment