Slide 43
Slide 43 text
/4UFQ-45. αϯϓϧ
© 2017 Retrieva, Inc. 43
class RNNNStepLSTM(chainer.Chain):
def __init__(self, n_layer, n_units, train=True):
super(RNNNStepLSTM, self).__init__(
l1 = L.NStepLSTM(n_layer, n_units, n_units, 0.5, True),
)
self.n_layer = n_layer
self.n_units = n_units
def __call__(self, xs):
xp = self.xp
hx = chainer.Variable(xp.zeros(
(self.n_layer, len(xs), self.n_units), dtype=xp.float32))
cx = chainer.Variable(xp.zeros(
(self.n_layer, len(xs), self.n_units), dtype=xp.float32))
hy, cy, ys = self.l1(hx, cx, xs, train=self.train)