Skip to content

[jit][script] Can't allocate zero gradients for a value without a type #8393

@jamesr66a

Description

@jamesr66a

See also #8410

Example:

import torch
@torch.jit.script
def unsqueezel(x):
    return x.unsqueeze(dim=-1)
x = torch.randn((2, 2), requires_grad=True)
unsqueezel(x)

output:

Traceback (most recent call last):
  File "dim.py", line 6, in <module>
    unsqueezel(x)
RuntimeError: torch/csrc/jit/autodiff.cpp:199: createZerosLike: can't allocate zero gradient for a value without a type

Operator level tests that fail with this:

  • test_add
  • test_add_broadcast_all
  • test_add_broadcast_lhs
  • test_add_broadcast_rhs
  • test_add_scalar
  • test_add_scalar_broadcast_lhs
  • test_add_scalar_broadcast_rhs
  • test_sub
  • test_sub_broadcast_all
  • test_sub_broadcast_lhs
  • test_sub_broadcast_rhs
  • test_sub_scalar_broadcast_lhs
  • test_sub_scalar_broadcast_rhs

Metadata

Metadata

Assignees

No one assigned

    Labels

    oncall: jitAdd this issue/PR to JIT oncall triage queue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions