MCPcopy Create free account
hub / github.com/pytorch/examples / forward

Method forward

legacy/snli/model.py:30–35  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

28 bidirectional=config.birnn)
29
30 def forward(self, inputs):
31 batch_size = inputs.size()[1]
32 state_shape = self.config.n_cells, batch_size, self.config.d_hidden
33 h0 = c0 = inputs.new_zeros(state_shape)
34 outputs, (ht, ct) = self.rnn(inputs, (h0, c0))
35 return ht[-1] if not self.config.birnn else ht[-2:].transpose(0, 1).contiguous().view(batch_size, -1)
36
37
38class SNLIClassifier(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected