dasguptar / treelstm.pytorch

Tree LSTM implementation in PyTorch
MIT License
550 stars 139 forks source link

Why move output to cpu? #18

Open ryh95 opened 6 years ago

ryh95 commented 6 years ago

I noticed that in test function of trainer module you write

output = output.data.squeeze().cpu()

Why you move output to cpu ?

By the way in SimilarityTreeLSTM of model module output = self.similarity(lstate, rstate)

Why don't use output = self.similarity(lhidden, rhidden)

dasguptar commented 6 years ago

Hi @ryh95 I don't remember if there was any particular reason for moving the output to CPU. As I have mentioned in some other comments, this model was my first time using PyTorch, so I was quite extra cautious in many places, and ended up being redundant. This move to CPU might be one such instance.

Regarding the difference between state and hidden, I believe I had run experiments using both, and ended up using the one that performed better. Let me see if I can dig up the results.