class_docstr: Torch autograd Function wrapper for KNN C++/CUDA implementations.
class_docstr_tok: ["Torch","autograd","Function","wrapper","for","KNN","C++\/CUDA","implementations","."]
code: def backward(ctx, grad_dists, grad_idx):
      p1, p2, lengths1, lengths2, idx = ctx.saved_tensors
      norm = ctx.norm
      # TODO(gkioxari) Change cast to floats once we add support for doubles.
      if not (grad_dists.dtype == torch.float32):
          grad_dists = grad_dists.float()
      if not (p1.dtype == torch.float32):
          p1 = p1.float()
      if not (p2.dtype == torch.float32):
          p2 = p2.float()
      grad_p1, grad_p2 = _C.knn_points_backward(
          p1, p2, lengths1, lengths2, idx, norm, grad_dists
      )
      return grad_p1, grad_p2, None, None, None, None, None, None
  
file_path: pytorch3d/pytorch3d/ops/knn.py
imports: from collections import namedtuple
  from typing import Union
  import torch
  from pytorch3d import _C
  from torch.autograd import Function
  from torch.autograd.function import once_differentiable
label_desc: Use image node_id 2 for calling the _knn_points obj's underlying member method code with example usage: obj.backward(ctx, grad_dists, grad_idx) and returns: grad_p1,  grad_p2,  None,  None,  None,  None,  None,  None