i try to reproduce 《Generating Sentences from a Continuous Space》with pytorch(version: 0.2.0_2), but geting stuck in some error:
File "CVAE.py", line 73, in forward
    output, hidden = self.rnn(embedded_dropout, h0)
  File "/opt/conda/envs/pytorch-py35/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/conda/envs/pytorch-py35/lib/python3.5/site-packages/torch/nn/modules/rnn.py", line 162, in forward
    output, hidden = func(input, self.all_weights, hx)
  File "/opt/conda/envs/pytorch-py35/lib/python3.5/site-packages/torch/nn/_functions/rnn.py", line 351, in forward
    return func(input, *fargs, **fkwargs)
  File "/opt/conda/envs/pytorch-py35/lib/python3.5/site-packages/torch/autograd/function.py", line 283, in _do_forward
    flat_input = tuple(_iter_variables(input))
  File "/opt/conda/envs/pytorch-py35/lib/python3.5/site-packages/torch/autograd/function.py", line 251, in _iter
    for var in _iter(o):
  File "/opt/conda/envs/pytorch-py35/lib/python3.5/site-packages/torch/autograd/function.py", line 255, in _iter
    "an input object of type " + torch.typename(obj))
ValueError: NestedIOFunction doesn't know how to process an input object of type CVAE._stats_from_z.<locals>.<genexpr>

from the message, error is caused by the function “_stats_from_z” :
batch_size = z.size()[0]
if self.decoder.params['rnn_cell'] == 'lstm':
    decoder_hidden = self.fc_h(z), self.fc_c(z)
    decoder_hidden = (h.view(self.decoder_params['n_layers'] * self.decoder.num_directions, batch_size, -1) for h in decoder_hidden)
    return decoder_hidden
else:
    decoder_hidden = self.fc_h(z).view(self.decoder_params['n_layers'] * self.decoder.num_directions, batch_size, -1)
    return decoder_hidden

when choose the ‘lstm’ branch, the error occur, the other branch(gru) is ok.
i don`t kown what is happening?