MCPcopy Create free account
hub / github.com/apache/singa / LSTMModel3

Class LSTMModel3

test/python/test_model.py:109–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107
108# lstm testing
109class LSTMModel3(model.Model):
110
111 def __init__(self, hidden_size):
112 super(LSTMModel3, self).__init__()
113 self.lstm = layer.CudnnRNN(
114 hidden_size=hidden_size,
115 batch_first=True,
116 # return_sequences=True,
117 use_mask=True)
118 self.l1 = layer.Linear(2)
119 self.optimizer = opt.SGD(0.1)
120
121 def forward(self, x, seq_lengths):
122 y = self.lstm(x, seq_lengths=seq_lengths)
123 y = autograd.reshape(y, (y.shape[0], -1))
124 y = self.l1(y)
125 return y
126
127
128class LSTMModel2(model.Model):

Callers 1

Calls

no outgoing calls

Tested by 1