class_docstr: Radial pooling from `Atomic Convolutional Networks for
  Predicting Protein-Ligand Binding Affinity <https://arxiv.org/abs/1703.10603>`__
  
  We denote the distance between atom :math:`i` and :math:`j` by :math:`r_{ij}`.
  
  A radial pooling layer transforms distances with radial filters. For radial filter
  indexed by :math:`k`, it projects edge distances with
  
  .. math::
      h_{ij}^{k} = \exp(-\gamma_{k}|r_{ij}-r_{k}|^2)
  
  If :math:`r_{ij} < c_k`,
  
  .. math::
      f_{ij}^{k} = 0.5 * \cos(\frac{\pi r_{ij}}{c_k} + 1),
  
  else,
  
  .. math::
      f_{ij}^{k} = 0.
  
  Finally,
  
  .. math::
      e_{ij}^{k} = h_{ij}^{k} * f_{ij}^{k}
  
  Parameters
  ----------
  interaction_cutoffs : float32 tensor of shape (K)
      :math:`c_k` in the equations above. Roughly they can be considered as learnable cutoffs
      and two atoms are considered as connected if the distance between them is smaller than
      the cutoffs. K for the number of radial filters.
  rbf_kernel_means : float32 tensor of shape (K)
      :math:`r_k` in the equations above. K for the number of radial filters.
  rbf_kernel_scaling : float32 tensor of shape (K)
      :math:`\gamma_k` in the equations above. K for the number of radial filters.
class_docstr_tok: ["Radial","pooling","from","`","Atomic","Convolutional","Networks","for","Predicting","Protein-Ligand","Binding","Affinity","<","https",":","\/\/arxiv.org\/abs\/1703.10603",">","`","__","We","denote","the","distance","between","atom",":","math",":","`","i","`","and",":","math",":","`","j","`","by",":","math",":","`","r_","{","ij","}","`",".","A","radial","pooling","layer","transforms","distances","with","radial","filters",".","For","radial","filter","indexed","by",":","math",":","`","k","`",",","it","projects","edge","distances","with","..","math",":",":","h_","{","ij","}","^","{","k","}","=","\\exp","(","-\\gamma_","{","k","}","|r_","{","ij","}","-r_","{","k","}","|^2",")","If",":","math",":","`","r_","{","ij","}","<","c_k","`",",","..","math",":",":","f_","{","ij","}","^","{","k","}","=","0.5","*","\\cos","(","\\frac","{","\\pi","r_","{","ij","}","}","{","c_k","}","+","1",")",",","else",",","..","math",":",":","f_","{","ij","}","^","{","k","}","=","0",".","Finally",",","..","math",":",":","e_","{","ij","}","^","{","k","}","=","h_","{","ij","}","^","{","k","}","*","f_","{","ij","}","^","{","k","}","Parameters","--","--","--","--","--","interaction_cutoffs",":","float32","tensor","of","shape","(","K",")",":","math",":","`","c_k","`","in","the","equations","above",".","Roughly","they","can","be","considered","as","learnable","cutoffs","and","two","atoms","are","considered","as","connected","if","the","distance","between","them","is","smaller","than","the","cutoffs",".","K","for","the","number","of","radial","filters",".","rbf_kernel_means",":","float32","tensor","of","shape","(","K",")",":","math",":","`","r_k","`","in","the","equations","above",".","K","for","the","number","of","radial","filters",".","rbf_kernel_scaling",":","float32","tensor","of","shape","(","K",")",":","math",":","`","\\gamma_k","`","in","the","equations","above",".","K","for","the","number","of","radial","filters","."]
docstr: Description
  -----------
  Apply the layer to transform edge distances.
  
  Parameters
  ----------
  distances : Float32 tensor of shape (E, 1)
      Distance between end nodes of edges. E for the number of edges.
  
  Returns
  -------
  Float32 tensor of shape (K, E, 1)
      Transformed edge distances. K for the number of radial filters.
docstr_tok: ["Description","--","--","--","--","--","-","Apply","the","layer","to","transform","edge","distances",".","Parameters","--","--","--","--","--","distances",":","Float32","tensor","of","shape","(","E",",","1",")","Distance","between","end","nodes","of","edges",".","E","for","the","number","of","edges",".","Returns","--","--","--","-","Float32","tensor","of","shape","(","K",",","E",",","1",")","Transformed","edge","distances",".","K","for","the","number","of","radial","filters","."]
code: def forward(self, distances):
      """
  
      Description
      -----------
      Apply the layer to transform edge distances.
  
      Parameters
      ----------
      distances : Float32 tensor of shape (E, 1)
          Distance between end nodes of edges. E for the number of edges.
  
      Returns
      -------
      Float32 tensor of shape (K, E, 1)
          Transformed edge distances. K for the number of radial filters.
      """
      scaled_euclidean_distance = (
          -self.rbf_kernel_scaling
          * (distances - self.rbf_kernel_means) ** 2
      )  # (K, E, 1)
      rbf_kernel_results = th.exp(
          scaled_euclidean_distance
      )  # (K, E, 1)
  
      cos_values = 0.5 * (
          th.cos(np.pi * distances / self.interaction_cutoffs) + 1
      )  # (K, E, 1)
      cutoff_values = th.where(
          distances <= self.interaction_cutoffs,
          cos_values,
          th.zeros_like(cos_values),
      )  # (K, E, 1)
  
      # Note that there appears to be an inconsistency between the paper and
      # DeepChem's implementation. In the paper, the scaled_euclidean_distance first
      # gets multiplied by cutoff_values, followed by exponentiation. Here we follow
      # the practice of DeepChem.
      return rbf_kernel_results * cutoff_values
  
file_path: dgl/python/dgl/nn/pytorch/conv/atomicconv.py
imports: import numpy
  import torch
  import torch.nn
label_desc: Use image node_id 2 for calling the RadialPooling obj's underlying member method code with example usage: obj.forward(distances) and returns: unknown