MCPcopy Create free account
hub / github.com/pytorch/tutorials / __init__

Method __init__

beginner_source/chatbot_tutorial.py:652–661  ·  view source on GitHub ↗
(self, hidden_size, embedding, n_layers=1, dropout=0)

Source from the content-addressed store, hash-verified

650
651class EncoderRNN(nn.Module):
652 def __init__(self, hidden_size, embedding, n_layers=1, dropout=0):
653 super(EncoderRNN, self).__init__()
654 self.n_layers = n_layers
655 self.hidden_size = hidden_size
656 self.embedding = embedding
657
658 # Initialize GRU; the input_size and hidden_size parameters are both set to 'hidden_size'
659 # because our input size is a word embedding with number of features == hidden_size
660 self.gru = nn.GRU(hidden_size, hidden_size, n_layers,
661 dropout=(0 if n_layers == 1 else dropout), bidirectional=True)
662
663 def forward(self, input_seq, input_lengths, hidden=None):
664 # Convert word indexes to embeddings

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected