Exemple #1
0
 def forward(ctx, xyz1, xyz2):
     xyz1 = xyz1.contiguous()
     xyz2 = xyz2.contiguous()
     assert xyz1.is_cuda and xyz2.is_cuda, "Only support cuda currently."
     dist1, idx1, dist2, idx2 = chamfer_cuda.chamfer_forward(xyz1, xyz2)
     ctx.save_for_backward(xyz1, xyz2, idx1, idx2)
     return dist1, dist2, idx1, idx2
Exemple #2
0
def nn_distance(xyz1, xyz2, transpose=True):
    """The interface to infer rather than train"""
    if xyz1.dim() == 2:
        xyz1 = xyz1.unsqueeze(0)
    if xyz2.dim() == 2:
        xyz2 = xyz2.unsqueeze(0)
    if transpose:
        xyz1 = xyz1.transpose(1, 2).contiguous()
        xyz2 = xyz2.transpose(1, 2).contiguous()
    return chamfer_cuda.chamfer_forward(xyz1, xyz2)