def __call__(self, cur_word):
# Given the current word ID, predict the next word.
x = self.embed(cur_word)
# dropout. ref: https://docs.chainer.org/en/stable/reference/generated/chainer.functions.dropout.html?highlight=dropout
with chainer.using_config('train', True):
x = F.dropout(x, self.dropout)
h = self.mid(x)
with chainer.using_config('train', True):
h = F.dropout(h, self.dropout)
y = self.out(h)
return y
评论列表
文章目录