Skip to content

Runtime error: dimension out of range #22

Open
@kindlychung

Description

@kindlychung
python test.py 
Variable containing:
(0 ,.,.) = 
  0.8000  0.3000  1.0000
  0.5000  0.0000  0.0000
[torch.FloatTensor of size 1x2x3]

Traceback (most recent call last):
  File "test.py", line 28, in <module>
    out, aux = g(input)
  File "/home/kaiyin/miniconda3/envs/torch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 325, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/kaiyin/PycharmProjects/stn.pytorch/script/modules/gridgen.py", line 30, in forward
    loss = torch.sum(loss,2)
RuntimeError: dimension out of range (expected to be in range of [-2, 1], but got 2)

Pytorch version: 0.3.0.post4
Python 3.6

Activity

wanrenjie

wanrenjie commented on Jan 18, 2018

@wanrenjie

I also find this problem. To solve this problem, I change the loss = torch.sum(loss,1), loss = torch.sum(loss,2) to loss = torch.sum(loss) directly. Is it right...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kindlychung@wanrenjie

        Issue actions

          Runtime error: dimension out of range · Issue #22 · fxia22/stn.pytorch