albanD:

You can slightly change your code to:


It raise the same jacobin error after i change the code like you suggest 



 albanD:

It does as long as you’re far-enough from a point where the max value changes. If the finite difference actually hit a point where you get a different max, then the test will fail.


I think the probaility of this happen is very low, so i think the diffierentiability is not the reason why the error raised. 



 albanD:

You actually give double types above no? Do you convert them back to float before doing the actual computation?


Yes, i convert them back to float at pytorch class encapsulation layer before doing the actual computation



 albanD:

The forward pass actually does an outer product between x and y right? I am surprised not to see one here.


The xyz1 and xyz2 are two point set each point has c channels.The forward pass is to find the nearest point for every point of xyz1 in xyz2 in the sence of euclidean distance. I think it is different from the outer product . What i do in the backward pass is to caculate the derivative of euclidean distance with respect to xyz1[i] and its nearest point in xyz2 which is determined during the forward pass.