Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: index 54 is out of bounds for dimension 0 with size 54 #38

Open
qingdujun opened this issue Jan 8, 2020 · 0 comments
Open

Comments

@qingdujun
Copy link

qingdujun commented Jan 8, 2020

tree.state = self.node_forward(inputs[tree.idx], child_c, child_h)

len(inputs) == 54
tree.idx == 54

tree.idx = idx - 1

more informations

inputs[tree.idx] tensor([[ 3.7410e-02,  5.7619e-02,  3.3822e-01,  ..., -3.5774e-02,
         -7.8579e-02,  1.0644e-02],
        [-2.5287e-02, -2.5835e-01, -7.5715e-02,  ...,  1.2864e-01,
          1.3856e-01,  3.3581e-01],
        [-5.4430e-02, -1.6442e-01, -6.7605e-02,  ...,  1.7388e-01,
         -3.9886e-01, -1.3006e-02],
        ...,
        [-2.5433e-02, -8.0709e-02,  6.2163e-01,  ...,  2.7345e-01,
         -5.6782e-02,  1.8956e-01],
        [-2.4587e-01,  8.9087e-03, -1.5240e-03,  ..., -3.2474e-01,
          1.1630e-02, -1.3252e-01],
        [ 4.9405e-04, -3.5795e-01, -2.2226e-01,  ..., -9.1428e-02,
          2.2649e-01, -2.0806e-01]], device='cuda:0',
       grad_fn=<EmbeddingBackward>)
Traceback (most recent call last):
  File "main.py", line 185, in <module>
    main()
  File "main.py", line 155, in main
    train_loss = trainer.train(train_dataset)
  File "/home/qingdujun/public/runtime/models/treelstm.pytorch/treelstm/trainer.py", line 29, in train
    output = self.model(linput, rtree, rinput)
  File "/home/qingdujun/Applications/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/qingdujun/public/runtime/models/treelstm.pytorch/treelstm/model.py", line 90, in forward
    rstate, rhidden = self.childsumtreelstm(rtree, rinputs)
  File "/home/qingdujun/Applications/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/qingdujun/public/runtime/models/treelstm.pytorch/treelstm/model.py", line 38, in forward
    self.forward(tree.children[idx], inputs)
  File "/home/qingdujun/public/runtime/models/treelstm.pytorch/treelstm/model.py", line 38, in forward
    self.forward(tree.children[idx], inputs)
  File "/home/qingdujun/public/runtime/models/treelstm.pytorch/treelstm/model.py", line 38, in forward
    self.forward(tree.children[idx], inputs)
  [Previous line repeated 10 more times]
  File "/home/qingdujun/public/runtime/models/treelstm.pytorch/treelstm/model.py", line 48, in forward
    tree.state = self.node_forward(inputs[tree.idx], child_c, child_h)
IndexError: index 54 is out of bounds for dimension 0 with size 54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant