jingweiz / pytorch-dnc

Neural Turing Machine (NTM) & Differentiable Neural Computer (DNC) with pytorch & visdom
MIT License
278 stars 52 forks source link

Latest PyTorch Issue #5

Closed jramapuram closed 7 years ago

jramapuram commented 7 years ago

I know you mention not supporting python 3, but this looks like just an issue with pytorch. I have built pytorch from HEAD to use the new features such as broadcasting.

➜  pytorch-dnc git:(master) python main.py 
Traceback (most recent call last):
  File "main.py", line 21, in <module>
    agent.fit_model()
  File "/home/jason/projects/pytorch-dnc/core/agents/sl_agent.py", line 115, in fit_model
    action = self._forward(self.experience.state1)
  File "/home/jason/projects/pytorch-dnc/core/agents/sl_agent.py", line 61, in _forward
    output_vb = self.circuit.forward(Variable(input_ts[i]))
  File "/home/jason/projects/pytorch-dnc/core/circuit.py", line 83, in forward
    self.read_vec_vb = self.accessor.forward(hidden_vb)
  File "/home/jason/projects/pytorch-dnc/core/accessors/static_accessor.py", line 48, in forward
    self.memory.memory_vb = self.write_heads.forward(hidden_vb, self.memory.memory_vb)
  File "/home/jason/projects/pytorch-dnc/core/heads/static_write_head.py", line 35, in forward
    super(StaticWriteHead, self).forward(hidden_vb, memory_vb)
  File "/home/jason/projects/pytorch-dnc/core/heads/static_head.py", line 104, in forward
    self._content_focus(memory_vb)
  File "/home/jason/projects/pytorch-dnc/core/heads/static_head.py", line 40, in _content_focus
    K_vb = batch_cosine_sim(self.key_vb, memory_vb)  # [batch_size x num_heads x mem_hei]
  File "/home/jason/projects/pytorch-dnc/utils/similarities.py", line 15, in batch_cosine_sim
    denominator = torch.sqrt(torch.bmm(u.norm(2, 2).pow(2) + epsilon, v.norm(2, 2).pow(2).transpose(1, 2) + epsilon))
  File "/home/jason/anaconda3/lib/python3.6/site-packages/torch/autograd/variable.py", line 706, in transpose
    return Transpose.apply(self, dim1, dim2)
  File "/home/jason/anaconda3/lib/python3.6/site-packages/torch/autograd/_functions/tensor.py", line 80, in forward
    result = i.transpose(dim1, dim2)
RuntimeError: dimension out of range (expected to be in range of [-2, 1], but got 2)
jingweiz commented 7 years ago

Hey, can you tell me which commit are you in? and also your pytorch version?

jramapuram commented 7 years ago

pytorch-dnc : 90d4584dddf66fd5db9318ea1e34a4db64535263 pytorch : 6f6d70ffeda9b9918b8fcd02ffea28b126e283e3

jingweiz commented 7 years ago

Hey, so since the next release would be out next week, I assume that I would use the release version and modify accordingly then.

jramapuram commented 7 years ago

Great, thanks!

SeekPoint commented 7 years ago

I got the same error

jingweiz commented 7 years ago

fixed in the latest commit for the latest release pytorch 0.2.0

jramapuram commented 7 years ago

Works, thanks!