Skip to content

Instantly share code, notes, and snippets.

@groverpr
Created March 22, 2020 02:09
Show Gist options
  • Save groverpr/64dd197278da805b96f43ad140ec0cfb to your computer and use it in GitHub Desktop.
Save groverpr/64dd197278da805b96f43ad140ec0cfb to your computer and use it in GitHub Desktop.
# Preparation of network arguments
ctx = [mx.gpu(0)] # use a GPU
tt = transformer_pipe.named_steps['token2index'] # to get token to integer map
max_idx = max(tt.tok2idx.values())+1 # size of vocabulary of all tokens in training data
tok_embed_dim = 64 # embedding size of each token
review_embed_dim = 50 # embedding size of hidden state in GRU
input_output_embed_map = {"token_embed": (max_idx, tok_embed_dim),
"hidden_embed": (None, review_embed_dim)}
dropouts = [0.2, 0.2, 0.2]
dense_sizes=[100, 100, 10]
activation="relu"
# Network object
net1 = CustomSeqNet(input_output_embed_map, dense_sizes, dropouts, activation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment