Skip to content

RuntimeError when trying to reuse a buffer #21469

@ifedan

Description

@ifedan

🐛 Bug

The code snippet below throws error. I'm trying to see if I could reuse a buffer.

To Reproduce

Steps to reproduce the behavior:

b = torch.randn(3, requires_grad=True)
c = torch.zeros(3) 
c[[1,2]] = b[[1,1]]
c.sum().backward() # ok
c.sum().backward() # fail

RuntimeError: ntensor >= 3 INTERNAL ASSERT FAILED at caffe2/aten/src/ATen/native/cpu/IndexKernel.cpp:51, please report a bug to PyTorch. 

Metadata

Metadata

Assignees

Labels

module: autogradRelated to torch.autograd, and the autograd engine in generalmodule: error checkingBugs related to incorrect/lacking error checkingtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions