MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / __init__

Method __init__

numpy_ml/tests/nn_torch_models.py:1574–1580  ·  view source on GitHub ↗
(self, vocab_size, n_out, params, **kwargs)

Source from the content-addressed store, hash-verified

1572
1573class TorchEmbeddingLayer(nn.Module):
1574 def __init__(self, vocab_size, n_out, params, **kwargs):
1575 super(TorchEmbeddingLayer, self).__init__()
1576 self.layer1 = nn.Embedding(vocab_size, n_out)
1577
1578 # explicitly set embedding weights
1579 self.layer1.weight = nn.Parameter(torch.FloatTensor(params["W"]))
1580 self.model = nn.Sequential(self.layer1)
1581
1582 def forward(self, X):
1583 self.X = X

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected