AaronTengDeChuan / CDT4UD_Chinese

0 stars 0 forks source link

为什么要重新初始化hidden和cell呢? #3

Open Oneplus opened 7 years ago

Oneplus commented 7 years ago

https://github.com/AaronTengDeChuan/CDT4UD_Chinese/blob/dc33f6f1492c939219b628a66b143c0bee7b203a/multi-task_learning_for_cdt--ud/Bi_LSTM_Model.py#L47

AaronTengDeChuan commented 7 years ago

batch_size 改变了,就需要初始化hidden和cell。 self.initCell = Variable(torch.zeros(2 if self.bidirectional else 1, _self.batchsize, self.hidden_size).cuda())