Skip to content

RuntimeError: dimension specified as 0 but tensor has no dimensions #5552

@liu-nlper

Description

@liu-nlper

My code run well under torch 0.2, however, the following error occurs when I use torch 0.3.1, why?

Traceback (most recent call last):
File "../train.py", line 149, in
loss.backward()
File "/home/jxliu/.local/lib/python3.6/site-packages/torch/autograd/variable.py", line 167, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, retain_variables)
File "/home/jxliu/.local/lib/python3.6/site-packages/torch/autograd/init.py", line 99, in backward
variables, grad_variables, retain_graph)
RuntimeError: dimension specified as 0 but tensor has no dimensions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions