Im using Pytorch3D to take a projection of a mesh and running backprop on the loss on that projection.
The simplified version of my task is:
mesh = load_objs_as_meshes([os.path.join(path, 'mesh.obj')], device=device)
criterion = torch.nn.MSELoss()
deform_verts = torch.full(mesh.verts_packed().shape, 0.0, dtype=torch.float32, device=meta.device, requires_grad=True)
mesh = mesh.offset_verts(deform_verts)
projection = project_mesh(smpl_mesh, angle).to(device)[0, :, :, 0] # gives the projected image at the required angle
loss = criterion(torch.flatten(projection), torch.flatten(ground_truth))
loss.backward()
The error im getting is :
RuntimeError: range.second - range.first == t.size() INTERNAL ASSERT FAILED at /opt/conda/conda-bld/pytorch_1587428094786/work/torch/csrc/autograd/generated/Functions.cpp:57, please report a bug to PyTorch. inconsistent range for TensorList output (copy_range at /opt/conda/conda-bld/pytorch_1587428094786/work/torch/csrc/autograd/generated/Functions.cpp:57)