def create_emb_layer(weights_matrix, non_trainable=False):
    (num_embeddings, embedding_dim) = weights_matrix.shape
    emb_layer = nn.Embedding(num_embeddings, embedding_dim)
    emb_layer.load_state_dict({'weight': torch.tensor(weights_matrix)})
    if non_trainable:
        emb_layer.weight.requires_grad = False
    return (emb_layer, num_embeddings, embedding_dim)
def create_emb_layer(weights_matrix, non_trainable=False):
    (num_embeddings, embedding_dim) = weights_matrix.shape
    emb_layer = nn.Embedding(num_embeddings, embedding_dim)
    emb_layer.load_state_dict({'weight': torch.tensor(weights_matrix)})
    if non_trainable:
        emb_layer.weight.requires_grad = False
    return (emb_layer, num_embeddings, embedding_dim)