class_docstr: Performs a node-level random split by adding :obj:`train_mask`,
  :obj:`val_mask` and :obj:`test_mask` attributes to the
  :class:`~torch_geometric.data.Data` or
  :class:`~torch_geometric.data.HeteroData` object
  (functional name: :obj:`random_node_split`).
  
  Args:
      split (str, optional): The type of dataset split (:obj:`"train_rest"`,
          :obj:`"test_rest"`, :obj:`"random"`).
          If set to :obj:`"train_rest"`, all nodes except those in the
          validation and test sets will be used for training (as in the
          `"FastGCN: Fast Learning with Graph Convolutional Networks via
          Importance Sampling" <https://arxiv.org/abs/1801.10247>`_ paper).
          If set to :obj:`"test_rest"`, all nodes except those in the
          training and validation sets will be used for test (as in the
          `"Pitfalls of Graph Neural Network Evaluation"
          <https://arxiv.org/abs/1811.05868>`_ paper).
          If set to :obj:`"random"`, train, validation, and test sets will be
          randomly generated, according to :obj:`num_train_per_class`,
          :obj:`num_val` and :obj:`num_test` (as in the `"Semi-supervised
          Classification with Graph Convolutional Networks"
          <https://arxiv.org/abs/1609.02907>`_ paper).
          (default: :obj:`"train_rest"`)
      num_splits (int, optional): The number of splits to add. If bigger
          than :obj:`1`, the shape of masks will be
          :obj:`[num_nodes, num_splits]`, and :obj:`[num_nodes]` otherwise.
          (default: :obj:`1`)
      num_train_per_class (int, optional): The number of training samples
          per class in case of :obj:`"test_rest"` and :obj:`"random"` split.
          (default: :obj:`20`)
      num_val (int or float, optional): The number of validation samples.
          If float, it represents the ratio of samples to include in the
          validation set. (default: :obj:`500`)
      num_test (int or float, optional): The number of test samples in case
          of :obj:`"train_rest"` and :obj:`"random"` split. If float, it
          represents the ratio of samples to include in the test set.
          (default: :obj:`1000`)
      key (str, optional): The name of the attribute holding ground-truth
          labels. By default, will only add node-level splits for node-level
          storages in which :obj:`key` is present. (default: :obj:`"y"`).
class_docstr_tok: ["Performs","a","node-level","random","split","by","adding",":","obj",":","`","train_mask","`",",",":","obj",":","`","val_mask","`","and",":","obj",":","`","test_mask","`","attributes","to","the",":","class",":","`","~torch_geometric.data.Data","`","or",":","class",":","`","~torch_geometric.data.HeteroData","`","object","(","functional","name",":",":","obj",":","`","random_node_split","`",")",".","Args",":","split","(","str",",","optional",")",":","The","type","of","dataset","split","(",":","obj",":","`","``","train_rest","''","`",",",":","obj",":","`","``","test_rest","''","`",",",":","obj",":","`","``","random","''","`",")",".","If","set","to",":","obj",":","`","``","train_rest","''","`",",","all","nodes","except","those","in","the","validation","and","test","sets","will","be","used","for","training","(","as","in","the","`","``","FastGCN",":","Fast","Learning","with","Graph","Convolutional","Networks","via","Importance","Sampling","''","<","https",":","\/\/arxiv.org\/abs\/1801.10247",">","`","_","paper",")",".","If","set","to",":","obj",":","`","``","test_rest","''","`",",","all","nodes","except","those","in","the","training","and","validation","sets","will","be","used","for","test","(","as","in","the","`","``","Pitfalls","of","Graph","Neural","Network","Evaluation","''","<","https",":","\/\/arxiv.org\/abs\/1811.05868",">","`","_","paper",")",".","If","set","to",":","obj",":","`","``","random","''","`",",","train",",","validation",",","and","test","sets","will","be","randomly","generated",",","according","to",":","obj",":","`","num_train_per_class","`",",",":","obj",":","`","num_val","`","and",":","obj",":","`","num_test","`","(","as","in","the","`","``","Semi-supervised","Classification","with","Graph","Convolutional","Networks","''","<","https",":","\/\/arxiv.org\/abs\/1609.02907",">","`","_","paper",")",".","(","default",":",":","obj",":","`","``","train_rest","''","`",")","num_splits","(","int",",","optional",")",":","The","number","of","splits","to","add",".","If","bigger","than",":","obj",":","`","1","`",",","the","shape","of","masks","will","be",":","obj",":","`","[","num_nodes",",","num_splits","]","`",",","and",":","obj",":","`","[","num_nodes","]","`","otherwise",".","(","default",":",":","obj",":","`","1","`",")","num_train_per_class","(","int",",","optional",")",":","The","number","of","training","samples","per","class","in","case","of",":","obj",":","`","``","test_rest","''","`","and",":","obj",":","`","``","random","''","`","split",".","(","default",":",":","obj",":","`","20","`",")","num_val","(","int","or","float",",","optional",")",":","The","number","of","validation","samples",".","If","float",",","it","represents","the","ratio","of","samples","to","include","in","the","validation","set",".","(","default",":",":","obj",":","`","500","`",")","num_test","(","int","or","float",",","optional",")",":","The","number","of","test","samples","in","case","of",":","obj",":","`","``","train_rest","''","`","and",":","obj",":","`","``","random","''","`","split",".","If","float",",","it","represents","the","ratio","of","samples","to","include","in","the","test","set",".","(","default",":",":","obj",":","`","1000","`",")","key","(","str",",","optional",")",":","The","name","of","the","attribute","holding","ground-truth","labels",".","By","default",",","will","only","add","node-level","splits","for","node-level","storages","in","which",":","obj",":","`","key","`","is","present",".","(","default",":",":","obj",":","`","``","y","''","`",")","."]
code: def __repr__(self) -> str:
      return f"{self.__class__.__name__}(split={self.split})"
  
file_path: pytorch_geometric/torch_geometric/transforms/random_node_split.py
imports: from typing import Optional, Tuple, Union
  import torch
  from torch import Tensor
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.data.datapipes import functional_transform
  from torch_geometric.data.storage import NodeStorage
  from torch_geometric.transforms import BaseTransform
label_desc: Use image node_id 4 for calling the RandomNodeSplit obj's underlying member method code with example usage: obj.__repr__() and returns: self, str, self, str