class_docstr: Applies padding to enforce consistent tensor shapes
  (functional name: :obj:`pad`).
  
  This transform will pad node and edge features up to a maximum allowed size
  in the node or edge feature dimension. By default :obj:`0.0` is used as the
  padding value and can be configured by setting :obj:`node_pad_value` and
  :obj:`edge_pad_value`.
  
  In case of applying :class:`Pad` to a :class:`~torch_geometric.data.Data`
  object, the :obj:`node_pad_value` value (or :obj:`edge_pad_value`) can be
  either:
  
  * an int, float or object of :class:`UniformPadding` class for cases when
    all attributes are going to be padded with the same value;
  * an object of :class:`AttrNamePadding` class for cases when padding is
    going to differ based on attribute names.
  
  In case of applying :class:`Pad` to a
  :class:`~torch_geometric.data.HeteroData` object, the :obj:`node_pad_value`
  value (or :obj:`edge_pad_value`) can be either:
  
  * an int, float or object of :class:`UniformPadding` class for cases when
    all attributes of all node (or edge) stores are going to be padded with
    the same value;
  * an object of :class:`AttrNamePadding` class for cases when padding is
    going to differ based on attribute names (but not based on node or edge
    types);
  * an object of class :class:`NodeTypePadding` or :class:`EdgeTypePadding`
    for cases when padding values are going to differ based on node or edge
    types. Padding values can also differ based on attribute names for a
    given node or edge type by using :class:`AttrNamePadding` objects as
    values of its `values` argument.
  
  Note that in order to allow for consistent padding across all graphs in a
  dataset, below conditions must be met:
  
  * if :obj:`max_num_nodes` is a single value, it must be greater than or
    equal to the maximum number of nodes of any graph in the dataset;
  * if :obj:`max_num_nodes` is a dictionary, value for every node type must
    be greater than or equal to the maximum number of this type nodes of any
    graph in the dataset.
  
  Example below shows how to create a :class:`Pad` transform for an
  :class:`~torch_geometric.data.HeteroData` object. The object is padded to
  have :obj:`10` nodes of type :obj:`v0`, :obj:`20` nodes of type :obj:`v1`
  and :obj:`30` nodes of type :obj:`v2`.
  It is padded to have :obj:`80` edges of type :obj:`('v0', 'e0', 'v1')`.
  All the attributes of the :obj:`v0` nodes are padded using a value of
  :obj:`3.0`.
  The :obj:`x` attribute of the :obj:`v1` node type is padded using a value
  of :obj:`-1.0`, and the other attributes of this node type are padded using
  a value of :obj:`0.5`.
  All the attributes of node types other than :obj:`v0` and :obj:`v1` are
  padded using a value of :obj:`1.0`.
  All the attributes of the :obj:`('v0', 'e0', 'v1')` edge type are padded
  usin a value of :obj:`3.5`.
  The :obj:`edge_attr` attributes of the :obj:`('v1', 'e0', 'v0')` edge type
  are padded using a value of :obj:`-1.5`, and any other attributes of this
  edge type are padded using a value of :obj:`5.5`.
  All the attributes of edge types other than these two are padded using a
  value of :obj:`1.5`.
  
  Example:
  .. code-block::
  
      num_nodes = {'v0': 10, 'v1': 20, 'v2':30}
      num_edges = {('v0', 'e0', 'v1'): 80}
  
      node_padding = NodeTypePadding({
          'v0': 3.0,
          'v1': AttrNamePadding({'x': -1.0}, default=0.5),
      }, default=1.0)
  
      edge_padding = EdgeTypePadding({
          ('v0', 'e0', 'v1'): 3.5,
          ('v1', 'e0', 'v0'): AttrNamePadding({'edge_attr': -1.5},
                                              default=5.5),
      }, default=1.5)
  
      transform = Pad(num_nodes, num_edges, node_padding, edge_padding)
  
  Args:
      max_num_nodes (int or dict): The number of nodes after padding.
          In heterogeneous graphs, may also take in a dictionary denoting the
          number of nodes for specific node types.
      max_num_edges (int or dict, optional): The number of edges after
          padding.
          In heterogeneous graphs, may also take in a dictionary denoting the
          number of edges for specific edge types. (default: :obj:`None`)
      node_pad_value (int or float or Padding, optional): The fill value to
          use for node features. (default: :obj:`0.0`)
      edge_pad_value (int or float or Padding, optional): The fill value to
          use for edge features. (default: :obj:`0.0`)
          The :obj:`edge_index` tensor is padded with with the index of the
          first padded node (which represents a set of self-loops on the
          padded node). (default: :obj:`0.0`)
      mask_pad_value (bool, optional): The fill value to use for
          :obj:`train_mask`, :obj:`val_mask` and :obj:`test_mask` attributes
          (default: :obj:`False`).
      add_pad_mask (bool, optional): If set to :obj:`True`, will attach
          node-level :obj:`pad_node_mask` and edge-level :obj:`pad_edge_mask`
          attributes to the output which indicates which elements in the data
          are real (represented by :obj:`True`) and which were added as a
          result of padding (represented by :obj:`False`).
          (default: :obj:`False`)
      exclude_keys ([str], optional): Keys to be removed
          from the input data object. (default: :obj:`None`)
class_docstr_tok: ["Applies","padding","to","enforce","consistent","tensor","shapes","(","functional","name",":",":","obj",":","`","pad","`",")",".","This","transform","will","pad","node","and","edge","features","up","to","a","maximum","allowed","size","in","the","node","or","edge","feature","dimension",".","By","default",":","obj",":","`","0.0","`","is","used","as","the","padding","value","and","can","be","configured","by","setting",":","obj",":","`","node_pad_value","`","and",":","obj",":","`","edge_pad_value","`",".","In","case","of","applying",":","class",":","`","Pad","`","to","a",":","class",":","`","~torch_geometric.data.Data","`","object",",","the",":","obj",":","`","node_pad_value","`","value","(","or",":","obj",":","`","edge_pad_value","`",")","can","be","either",":","*","an","int",",","float","or","object","of",":","class",":","`","UniformPadding","`","class","for","cases","when","all","attributes","are","going","to","be","padded","with","the","same","value",";","*","an","object","of",":","class",":","`","AttrNamePadding","`","class","for","cases","when","padding","is","going","to","differ","based","on","attribute","names",".","In","case","of","applying",":","class",":","`","Pad","`","to","a",":","class",":","`","~torch_geometric.data.HeteroData","`","object",",","the",":","obj",":","`","node_pad_value","`","value","(","or",":","obj",":","`","edge_pad_value","`",")","can","be","either",":","*","an","int",",","float","or","object","of",":","class",":","`","UniformPadding","`","class","for","cases","when","all","attributes","of","all","node","(","or","edge",")","stores","are","going","to","be","padded","with","the","same","value",";","*","an","object","of",":","class",":","`","AttrNamePadding","`","class","for","cases","when","padding","is","going","to","differ","based","on","attribute","names","(","but","not","based","on","node","or","edge","types",")",";","*","an","object","of","class",":","class",":","`","NodeTypePadding","`","or",":","class",":","`","EdgeTypePadding","`","for","cases","when","padding","values","are","going","to","differ","based","on","node","or","edge","types",".","Padding","values","can","also","differ","based","on","attribute","names","for","a","given","node","or","edge","type","by","using",":","class",":","`","AttrNamePadding","`","objects","as","values","of","its","`","values","`","argument",".","Note","that","in","order","to","allow","for","consistent","padding","across","all","graphs","in","a","dataset",",","below","conditions","must","be","met",":","*","if",":","obj",":","`","max_num_nodes","`","is","a","single","value",",","it","must","be","greater","than","or","equal","to","the","maximum","number","of","nodes","of","any","graph","in","the","dataset",";","*","if",":","obj",":","`","max_num_nodes","`","is","a","dictionary",",","value","for","every","node","type","must","be","greater","than","or","equal","to","the","maximum","number","of","this","type","nodes","of","any","graph","in","the","dataset",".","Example","below","shows","how","to","create","a",":","class",":","`","Pad","`","transform","for","an",":","class",":","`","~torch_geometric.data.HeteroData","`","object",".","The","object","is","padded","to","have",":","obj",":","`","10","`","nodes","of","type",":","obj",":","`","v0","`",",",":","obj",":","`","20","`","nodes","of","type",":","obj",":","`","v1","`","and",":","obj",":","`","30","`","nodes","of","type",":","obj",":","`","v2","`",".","It","is","padded","to","have",":","obj",":","`","80","`","edges","of","type",":","obj",":","`","(","'v0","'",",","'e0","'",",","'v1","'",")","`",".","All","the","attributes","of","the",":","obj",":","`","v0","`","nodes","are","padded","using","a","value","of",":","obj",":","`","3.0","`",".","The",":","obj",":","`","x","`","attribute","of","the",":","obj",":","`","v1","`","node","type","is","padded","using","a","value","of",":","obj",":","`","-1.0","`",",","and","the","other","attributes","of","this","node","type","are","padded","using","a","value","of",":","obj",":","`","0.5","`",".","All","the","attributes","of","node","types","other","than",":","obj",":","`","v0","`","and",":","obj",":","`","v1","`","are","padded","using","a","value","of",":","obj",":","`","1.0","`",".","All","the","attributes","of","the",":","obj",":","`","(","'v0","'",",","'e0","'",",","'v1","'",")","`","edge","type","are","padded","usin","a","value","of",":","obj",":","`","3.5","`",".","The",":","obj",":","`","edge_attr","`","attributes","of","the",":","obj",":","`","(","'v1","'",",","'e0","'",",","'v0","'",")","`","edge","type","are","padded","using","a","value","of",":","obj",":","`","-1.5","`",",","and","any","other","attributes","of","this","edge","type","are","padded","using","a","value","of",":","obj",":","`","5.5","`",".","All","the","attributes","of","edge","types","other","than","these","two","are","padded","using","a","value","of",":","obj",":","`","1.5","`",".","Example",":","..","code-block",":",":","num_nodes","=","{","'v0","'",":","10",",","'v1","'",":","20",",","'v2':30","}","num_edges","=","{","(","'v0","'",",","'e0","'",",","'v1","'",")",":","80","}","node_padding","=","NodeTypePadding","(","{","'v0","'",":","3.0",",","'v1","'",":","AttrNamePadding","(","{","'","x","'",":","-1.0","}",",","default=0.5",")",",","}",",","default=1.0",")","edge_padding","=","EdgeTypePadding","(","{","(","'v0","'",",","'e0","'",",","'v1","'",")",":","3.5",",","(","'v1","'",",","'e0","'",",","'v0","'",")",":","AttrNamePadding","(","{","'edge_attr","'",":","-1.5","}",",","default=5.5",")",",","}",",","default=1.5",")","transform","=","Pad","(","num_nodes",",","num_edges",",","node_padding",",","edge_padding",")","Args",":","max_num_nodes","(","int","or","dict",")",":","The","number","of","nodes","after","padding",".","In","heterogeneous","graphs",",","may","also","take","in","a","dictionary","denoting","the","number","of","nodes","for","specific","node","types",".","max_num_edges","(","int","or","dict",",","optional",")",":","The","number","of","edges","after","padding",".","In","heterogeneous","graphs",",","may","also","take","in","a","dictionary","denoting","the","number","of","edges","for","specific","edge","types",".","(","default",":",":","obj",":","`","None","`",")","node_pad_value","(","int","or","float","or","Padding",",","optional",")",":","The","fill","value","to","use","for","node","features",".","(","default",":",":","obj",":","`","0.0","`",")","edge_pad_value","(","int","or","float","or","Padding",",","optional",")",":","The","fill","value","to","use","for","edge","features",".","(","default",":",":","obj",":","`","0.0","`",")","The",":","obj",":","`","edge_index","`","tensor","is","padded","with","with","the","index","of","the","first","padded","node","(","which","represents","a","set","of","self-loops","on","the","padded","node",")",".","(","default",":",":","obj",":","`","0.0","`",")","mask_pad_value","(","bool",",","optional",")",":","The","fill","value","to","use","for",":","obj",":","`","train_mask","`",",",":","obj",":","`","val_mask","`","and",":","obj",":","`","test_mask","`","attributes","(","default",":",":","obj",":","`","False","`",")",".","add_pad_mask","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","will","attach","node-level",":","obj",":","`","pad_node_mask","`","and","edge-level",":","obj",":","`","pad_edge_mask","`","attributes","to","the","output","which","indicates","which","elements","in","the","data","are","real","(","represented","by",":","obj",":","`","True","`",")","and","which","were","added","as","a","result","of","padding","(","represented","by",":","obj",":","`","False","`",")",".","(","default",":",":","obj",":","`","False","`",")","exclude_keys","(","[","str","]",",","optional",")",":","Keys","to","be","removed","from","the","input","data","object",".","(","default",":",":","obj",":","`","None","`",")"]
docstr: Pads the input tensor in the specified dim with a constant value of
  the given length.
docstr_tok: ["Pads","the","input","tensor","in","the","specified","dim","with","a","constant","value","of","the","given","length","."]
code: def _pad_tensor_dim(
      input: torch.Tensor, dim: int, length: int, pad_value: float
  ) -> torch.Tensor:
      r"""Pads the input tensor in the specified dim with a constant value of
      the given length.
      """
      pads = [0] * (2 * input.ndim)
      pads[-2 * dim - 1] = length
      return F.pad(input, pads, "constant", pad_value)
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.data.datapipes import functional_transform
  from torch_geometric.data.storage import EdgeStorage, NodeStorage
  from torch_geometric.transforms import BaseTransform
  from torch_geometric.typing import EdgeType, NodeType
label_desc: Use image node_id 9 for calling the Pad obj's underlying member method code with example usage: obj._pad_tensor_dim(input, dim, length, pad_value) and returns: F