Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@braingineer

This comment has been minimized.

Copy link
Owner Author

braingineer commented Oct 8, 2018

x_embedded = embedding(batch_dict[...])

  1. it should be (batch, feat, seq)
  2. conv1 = nn.Conv1d(
    in_channels=feat,
    out_channels=??,
    kernel_size=??,
    stride=1,
    padding=0
    )
@braingineer

This comment has been minimized.

Copy link
Owner Author

braingineer commented Oct 8, 2018

batch_gen = generate_batches(train_dataset, batch_size=8)
batch_dict = next(batch_gen)

embeddings = nn.Embedding(num_embeddings=len(vectorizer.surname_vocab), 
                          embedding_dim=hyperparams.embedding_dim, 
                          padding_idx=0)

x_embedded = embeddings(batch_dict['x_surnames'])
x_embedded.shape

x_embedded_fixed = x_embedded.permute(0, 2, 1)
x_embedded_fixed.shape

conv1 = nn.Conv1d(in_channels=hyperparams.embedding_dim,
                  out_channels=16, 
                  kernel_size=3)
conv1(x_embedded_fixed).shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.