Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lesson 1: hstack vs. vstack #9

Open
gitfourteen opened this issue Aug 21, 2019 · 0 comments
Open

Lesson 1: hstack vs. vstack #9

gitfourteen opened this issue Aug 21, 2019 · 0 comments

Comments

@gitfourteen
Copy link

gitfourteen commented Aug 21, 2019

torchtext.__version__ '0.3.1'

test_preds = []
for x, y in tqdm.tqdm(test_dl):
    preds = model(x)
    # if you're data is on the GPU, you need to move the data back to the cpu
    # preds = preds.data.cpu().numpy()
    preds = preds.data.numpy()
    # the actual outputs of the model are logits, so we need to pass these values to the sigmoid function
    preds = 1 / (1 + np.exp(-preds))
    test_preds.append(preds)
test_preds = np.hstack(test_preds)

In my experiment, the correct one should be np.vstack .
The elements of list test_preds are type ndarrays with shape (batches, features=6) and the batches of the last element might be different from others if total number of samples can not be divided by batch_size

@gitfourteen gitfourteen changed the title hstack vs. vstack Lesson 1: hstack vs. vstack Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant