otaheri / chamfer_distance

Implementation of the Chamfer Distance as a module for PyTorch
MIT License
166 stars 20 forks source link

backward doesn't work #7

Open vertzeran opened 2 years ago

vertzeran commented 2 years ago

Hello, trying to use in an optimization procedure. Trying out the demo code

import torch from chamfer_distance import ChamferDistance import time

chamfer_dist = ChamferDistance()

p1 = torch.rand([10,25,3], requires_grad=True) p2 = torch.rand([10,15,3], requires_grad=True)

dist1, dist2, idx1, idx2 = chamfer_dist(p1,p2) loss = (torch.mean(dist1)) + (torch.mean(dist2))

then adding loss.backwad()

I get : "TypeError: backward( takes 4 positional argument but 5 were given" using torch version 1.9.1 on a linux system.

Eran

YishaiEArbe commented 2 years ago

Same for me with torch 1.8.0

otaheri commented 2 years ago

@vertzeran @YishaiEArbe Please use the latest version of the code to solve the issue.