class_docstr: Perform weighted sum to generate output features according to scores.
  Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/
  scene_seg/lib/paconv_lib/src/gpu>`_.
  
  This is a memory-efficient CUDA implementation of assign_scores operation,
  which first transform all point features with weight bank, then assemble
  neighbor features with ``knn_idx`` and perform weighted sum of ``scores``.
  
  See the `paper <https://arxiv.org/pdf/2103.14635.pdf>`_ appendix Sec. D for
      more detailed descriptions.
  
  Note:
      This implementation assumes using ``neighbor`` kernel input, which is
          (point_features - center_features, point_features).
      See https://github.com/CVMI-Lab/PAConv/blob/main/scene_seg/model/
      pointnet2/paconv.py#L128 for more details.
class_docstr_tok: ["Perform","weighted","sum","to","generate","output","features","according","to","scores",".","Modified","from","`","PAConv","<","https",":","\/\/github.com\/CVMI-Lab\/PAConv\/tree\/main\/","scene_seg\/lib\/paconv_lib\/src\/gpu",">","`","_",".","This","is","a","memory-efficient","CUDA","implementation","of","assign_scores","operation",",","which","first","transform","all","point","features","with","weight","bank",",","then","assemble","neighbor","features","with","``","knn_idx","``","and","perform","weighted","sum","of","``","scores","``",".","See","the","`","paper","<","https",":","\/\/arxiv.org\/pdf\/2103.14635.pdf",">","`","_","appendix","Sec",".","D","for","more","detailed","descriptions",".","Note",":","This","implementation","assumes","using","``","neighbor","``","kernel","input",",","which","is","(","point_features","-","center_features",",","point_features",")",".","See","https",":","\/\/github.com\/CVMI-Lab\/PAConv\/blob\/main\/scene_seg\/model\/","pointnet2\/paconv.py","#","L128","for","more","details","."]
docstr: Args:
      grad_out (torch.Tensor): (B, out_dim, npoint, K)
  
  Returns:
      grad_scores (torch.Tensor): (B, npoint, K, M)
      grad_point_features (torch.Tensor): (B, N, M, out_dim)
      grad_center_features (torch.Tensor): (B, N, M, out_dim)
docstr_tok: ["Args",":","grad_out","(","torch.Tensor",")",":","(","B",",","out_dim",",","npoint",",","K",")","Returns",":","grad_scores","(","torch.Tensor",")",":","(","B",",","npoint",",","K",",","M",")","grad_point_features","(","torch.Tensor",")",":","(","B",",","N",",","M",",","out_dim",")","grad_center_features","(","torch.Tensor",")",":","(","B",",","N",",","M",",","out_dim",")"]
code: def backward(ctx, grad_out):
      """
      Args:
          grad_out (torch.Tensor): (B, out_dim, npoint, K)
  
      Returns:
          grad_scores (torch.Tensor): (B, npoint, K, M)
          grad_point_features (torch.Tensor): (B, N, M, out_dim)
          grad_center_features (torch.Tensor): (B, N, M, out_dim)
      """
      (
          _,
          point_features,
          center_features,
          scores,
          knn_idx,
      ) = ctx.saved_tensors
  
      agg = ctx.agg
  
      B, N, M, out_dim = point_features.size()
      _, npoint, K, _ = scores.size()
  
      grad_point_features = point_features.new_zeros(
          point_features.shape
      )
      grad_center_features = center_features.new_zeros(
          center_features.shape
      )
      grad_scores = scores.new_zeros(scores.shape)
  
      ext_module.assign_score_withk_backward(
          grad_out.contiguous(),
          point_features.contiguous(),
          center_features.contiguous(),
          scores.contiguous(),
          knn_idx.contiguous(),
          grad_point_features,
          grad_center_features,
          grad_scores,
          B=B,
          N0=N,
          N1=npoint,
          M=M,
          K=K,
          O=out_dim,
          aggregate=agg,
      )
  
      return (
          grad_scores,
          grad_point_features,
          grad_center_features,
          None,
          None,
      )
  
imports: from torch.autograd import Function
  from ..utils import ext_loader
label_desc: Use image node_id 2 for calling the AssignScoreWithK obj's underlying member method code with example usage: obj.backward(ctx, grad_out) and returns: grad_scores,  grad_point_features,  grad_center_features,  None,  None