OK, I fixed the error myself. The problem is that,
topic_embedding.cuda()

is executed after the network is initialized. As a result, during network initialization the output of the LSTM layer is of type “torch.XXX 17”, while the input of this layer is hard coded as “torch.cuda.XXXX”.
To fix this, I need remove “.cuda()” from all variables within the network definition block. In addition, the “init_hidden” function also need be modified so that it is adaptive to both CPU and GPU:
def init_hidden(self, x):
    return (Variable(x.data.new(self.n_lstm_layers, x.size(1), 128).zero_()),
            Variable(x.data.new(self.n_lstm_layers, x.size(1), 128).zero_()))