en_init_state=(Variable(torch.zeros((layers*bi,batch,hidden))),Variable(torch.zeros(
                (layers*bi,batch,hidden))))

enc_final, memory_bank = self.encoder(src,encoder_state=en_init_state)

if I don’t use en_init_state to init this encoder, using ( self.encoder(src) ), it work fine. why??
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 357, in call
result = self.forward(*input, **kwargs)
File “/home/wds/codes/MMEnhancedEncoder/onmt/Models.py”, line 163, in forward
memory_bank, encoder_final = self.rnn(packed_emb, encoder_state)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 357, in call
result = self.forward(*input, **kwargs)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/rnn.py”, line 204, in forward
output, hidden = func(input, self.all_weights, hx)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/_functions/rnn.py”, line 385, in forward
return func(input, *fargs, **fkwargs)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/autograd/function.py”, line 328, in _do_forward
flat_output = super(NestedIOFunction, self)._do_forward(*flat_input)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/autograd/function.py”, line 350, in forward
result = self.forward_extended(*nested_tensors)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/_functions/rnn.py”, line 294, in forward_extended
cudnn.rnn.forward(self, input, hx, weight, output, hy)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/backends/cudnn/rnn.py”, line 235, in forward
fn.hx_desc = cudnn.descriptor(hx)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/backends/cudnn/init.py”, line 338, in descriptor
descriptor.set(tensor)
File “/home/wds/.conda/envs/pytorch/lib/python3.6/site-packages/torch/backends/cudnn/init.py”, line 139, in set
self, _typemap[tensor.type()], tensor.dim(),
KeyError: ‘torch.FloatTensor’