class_docstr: An abstract base class for cugraph-ops nn module.
docstr: Pad zero-in-degree nodes to the end of offsets to reach size.
  
  cugraph-ops often provides two variants of aggregation functions for a
  specific model: one intended for sampled-graph use cases, one for
  full-graph ones. The former is in general more performant, however, it
  only works when the sample size (the max of in-degrees) is small (<200),
  due to the limit of GPU shared memory. For graphs with a larger max
  in-degree, we need to fall back to the full-graph option, which requires
  to convert a DGL block to a full graph. With the csc-representation,
  this is equivalent to pad zero-in-degree nodes to the end of the offsets
  array (also called indptr or colptr).
  
  Parameters
  ----------
  offsets :
      The (monotonically increasing) index pointer array in a CSC-format
      graph.
  size : int
      The length of offsets after padding.
  
  Returns
  -------
  torch.Tensor
      The augmented offsets array.
docstr_tok: ["Pad","zero-in-degree","nodes","to","the","end","of","offsets","to","reach","size",".","cugraph-ops","often","provides","two","variants","of","aggregation","functions","for","a","specific","model",":","one","intended","for","sampled-graph","use","cases",",","one","for","full-graph","ones",".","The","former","is","in","general","more","performant",",","however",",","it","only","works","when","the","sample","size","(","the","max","of","in-degrees",")","is","small","(","<","200",")",",","due","to","the","limit","of","GPU","shared","memory",".","For","graphs","with","a","larger","max","in-degree",",","we","need","to","fall","back","to","the","full-graph","option",",","which","requires","to","convert","a","DGL","block","to","a","full","graph",".","With","the","csc-representation",",","this","is","equivalent","to","pad","zero-in-degree","nodes","to","the","end","of","the","offsets","array","(","also","called","indptr","or","colptr",")",".","Parameters","--","--","--","--","--","offsets",":","The","(","monotonically","increasing",")","index","pointer","array","in","a","CSC-format","graph",".","size",":","int","The","length","of","offsets","after","padding",".","Returns","--","--","--","-","torch.Tensor","The","augmented","offsets","array","."]
code: def pad_offsets(
      self, offsets: torch.Tensor, size: int
  ) -> torch.Tensor:
      r"""Pad zero-in-degree nodes to the end of offsets to reach size.
  
      cugraph-ops often provides two variants of aggregation functions for a
      specific model: one intended for sampled-graph use cases, one for
      full-graph ones. The former is in general more performant, however, it
      only works when the sample size (the max of in-degrees) is small (<200),
      due to the limit of GPU shared memory. For graphs with a larger max
      in-degree, we need to fall back to the full-graph option, which requires
      to convert a DGL block to a full graph. With the csc-representation,
      this is equivalent to pad zero-in-degree nodes to the end of the offsets
      array (also called indptr or colptr).
  
      Parameters
      ----------
      offsets :
          The (monotonically increasing) index pointer array in a CSC-format
          graph.
      size : int
          The length of offsets after padding.
  
      Returns
      -------
      torch.Tensor
          The augmented offsets array.
      """
      if self._cached_offsets_fg is None:
          self._cached_offsets_fg = torch.empty(
              size, dtype=offsets.dtype, device=offsets.device
          )
      elif self._cached_offsets_fg.numel() < size:
          self._cached_offsets_fg.resize_(size)
  
      self._cached_offsets_fg[: offsets.numel()] = offsets
      self._cached_offsets_fg[offsets.numel() : size] = offsets[-1]
  
      return self._cached_offsets_fg[:size]
  
file_path: dgl/python/dgl/nn/pytorch/conv/cugraph_base.py
imports: import torch
  from torch import nn
label_desc: Use image node_id 4 for calling the CuGraphBaseConv obj's underlying member method code with example usage: obj.pad_offsets(offsets, size) and returns: self