class_docstr: Converts a :class:`~torch_geometric.data.Data` or
  :class:`~torch_geometric.data.HeteroData` object into a
  :class:`pytorch_lightning.LightningDataModule` variant. It can then be
  automatically used as a :obj:`datamodule` for multi-GPU node-level
  training via :lightning:`null`
  `PyTorch Lightning <https://www.pytorchlightning.ai>`__.
  :class:`LightningDataset` will take care of providing mini-batches via
  :class:`~torch_geometric.loader.NeighborLoader`.
  
  .. note::
  
      Currently only the
      :class:`pytorch_lightning.strategies.SingleDeviceStrategy` and
      :class:`pytorch_lightning.strategies.DDPStrategy` training
      strategies of :lightning:`null` `PyTorch Lightning
      <https://pytorch-lightning.readthedocs.io/en/latest/guides/
      speed.html>`__ are supported in order to correctly share data across
      all devices/processes:
  
      .. code-block::
  
          import pytorch_lightning as pl
          trainer = pl.Trainer(strategy="ddp_spawn", accelerator="gpu",
                               devices=4)
          trainer.fit(model, datamodule)
  
  Args:
      data (Data or HeteroData): The :class:`~torch_geometric.data.Data` or
          :class:`~torch_geometric.data.HeteroData` graph object.
      input_train_nodes (torch.Tensor or str or (str, torch.Tensor)): The
          indices of training nodes.
          If not given, will try to automatically infer them from the
          :obj:`data` object by searching for :obj:`train_mask`,
          :obj:`train_idx`, or :obj:`train_index` attributes.
          (default: :obj:`None`)
      input_train_time (torch.Tensor, optional): The timestamp
          of training nodes. (default: :obj:`None`)
      input_val_nodes (torch.Tensor or str or (str, torch.Tensor)): The
          indices of validation nodes.
          If not given, will try to automatically infer them from the
          :obj:`data` object by searching for :obj:`val_mask`,
          :obj:`valid_mask`, :obj:`val_idx`, :obj:`valid_idx`,
          :obj:`val_index`, or :obj:`valid_index` attributes.
          (default: :obj:`None`)
      input_val_time (torch.Tensor, optional): The timestamp
          of validation edges. (default: :obj:`None`)
      input_test_nodes (torch.Tensor or str or (str, torch.Tensor)): The
          indices of test nodes.
          If not given, will try to automatically infer them from the
          :obj:`data` object by searching for :obj:`test_mask`,
          :obj:`test_idx`, or :obj:`test_index` attributes.
          (default: :obj:`None`)
      input_test_time (torch.Tensor, optional): The timestamp
          of test nodes. (default: :obj:`None`)
      input_pred_nodes (torch.Tensor or str or (str, torch.Tensor)): The
          indices of prediction nodes.
          If not given, will try to automatically infer them from the
          :obj:`data` object by searching for :obj:`pred_mask`,
          :obj:`pred_idx`, or :obj:`pred_index` attributes.
          (default: :obj:`None`)
      input_pred_time (torch.Tensor, optional): The timestamp
          of prediction nodes. (default: :obj:`None`)
      loader (str): The scalability technique to use (:obj:`"full"`,
          :obj:`"neighbor"`). (default: :obj:`"neighbor"`)
      node_sampler (BaseSampler, optional): A custom sampler object to
          generate mini-batches. If set, will ignore the :obj:`loader`
          option. (default: :obj:`None`)
      eval_loader_kwargs (Dict[str, Any], optional): Custom keyword arguments
          that override the :class:`torch_geometric.loader.NeighborLoader`
          configuration during evaluation. (default: :obj:`None`)
      **kwargs (optional): Additional arguments of
          :class:`torch_geometric.loader.NeighborLoader`.
class_docstr_tok: ["Converts","a",":","class",":","`","~torch_geometric.data.Data","`","or",":","class",":","`","~torch_geometric.data.HeteroData","`","object","into","a",":","class",":","`","pytorch_lightning.LightningDataModule","`","variant",".","It","can","then","be","automatically","used","as","a",":","obj",":","`","datamodule","`","for","multi-GPU","node-level","training","via",":","lightning",":","`","null","`","`","PyTorch","Lightning","<","https",":","\/\/www.pytorchlightning.ai",">","`","__",".",":","class",":","`","LightningDataset","`","will","take","care","of","providing","mini-batches","via",":","class",":","`","~torch_geometric.loader.NeighborLoader","`",".","..","note",":",":","Currently","only","the",":","class",":","`","pytorch_lightning.strategies.SingleDeviceStrategy","`","and",":","class",":","`","pytorch_lightning.strategies.DDPStrategy","`","training","strategies","of",":","lightning",":","`","null","`","`","PyTorch","Lightning","<","https",":","\/\/pytorch-lightning.readthedocs.io\/en\/latest\/guides\/","speed.html",">","`","__","are","supported","in","order","to","correctly","share","data","across","all","devices\/processes",":","..","code-block",":",":","import","pytorch_lightning","as","pl","trainer","=","pl.Trainer","(","strategy=","''","ddp_spawn","''",",","accelerator=","''","gpu","''",",","devices=4",")","trainer.fit","(","model",",","datamodule",")","Args",":","data","(","Data","or","HeteroData",")",":","The",":","class",":","`","~torch_geometric.data.Data","`","or",":","class",":","`","~torch_geometric.data.HeteroData","`","graph","object",".","input_train_nodes","(","torch.Tensor","or","str","or","(","str",",","torch.Tensor",")",")",":","The","indices","of","training","nodes",".","If","not","given",",","will","try","to","automatically","infer","them","from","the",":","obj",":","`","data","`","object","by","searching","for",":","obj",":","`","train_mask","`",",",":","obj",":","`","train_idx","`",",","or",":","obj",":","`","train_index","`","attributes",".","(","default",":",":","obj",":","`","None","`",")","input_train_time","(","torch.Tensor",",","optional",")",":","The","timestamp","of","training","nodes",".","(","default",":",":","obj",":","`","None","`",")","input_val_nodes","(","torch.Tensor","or","str","or","(","str",",","torch.Tensor",")",")",":","The","indices","of","validation","nodes",".","If","not","given",",","will","try","to","automatically","infer","them","from","the",":","obj",":","`","data","`","object","by","searching","for",":","obj",":","`","val_mask","`",",",":","obj",":","`","valid_mask","`",",",":","obj",":","`","val_idx","`",",",":","obj",":","`","valid_idx","`",",",":","obj",":","`","val_index","`",",","or",":","obj",":","`","valid_index","`","attributes",".","(","default",":",":","obj",":","`","None","`",")","input_val_time","(","torch.Tensor",",","optional",")",":","The","timestamp","of","validation","edges",".","(","default",":",":","obj",":","`","None","`",")","input_test_nodes","(","torch.Tensor","or","str","or","(","str",",","torch.Tensor",")",")",":","The","indices","of","test","nodes",".","If","not","given",",","will","try","to","automatically","infer","them","from","the",":","obj",":","`","data","`","object","by","searching","for",":","obj",":","`","test_mask","`",",",":","obj",":","`","test_idx","`",",","or",":","obj",":","`","test_index","`","attributes",".","(","default",":",":","obj",":","`","None","`",")","input_test_time","(","torch.Tensor",",","optional",")",":","The","timestamp","of","test","nodes",".","(","default",":",":","obj",":","`","None","`",")","input_pred_nodes","(","torch.Tensor","or","str","or","(","str",",","torch.Tensor",")",")",":","The","indices","of","prediction","nodes",".","If","not","given",",","will","try","to","automatically","infer","them","from","the",":","obj",":","`","data","`","object","by","searching","for",":","obj",":","`","pred_mask","`",",",":","obj",":","`","pred_idx","`",",","or",":","obj",":","`","pred_index","`","attributes",".","(","default",":",":","obj",":","`","None","`",")","input_pred_time","(","torch.Tensor",",","optional",")",":","The","timestamp","of","prediction","nodes",".","(","default",":",":","obj",":","`","None","`",")","loader","(","str",")",":","The","scalability","technique","to","use","(",":","obj",":","`","``","full","''","`",",",":","obj",":","`","``","neighbor","''","`",")",".","(","default",":",":","obj",":","`","``","neighbor","''","`",")","node_sampler","(","BaseSampler",",","optional",")",":","A","custom","sampler","object","to","generate","mini-batches",".","If","set",",","will","ignore","the",":","obj",":","`","loader","`","option",".","(","default",":",":","obj",":","`","None","`",")","eval_loader_kwargs","(","Dict","[","str",",","Any","]",",","optional",")",":","Custom","keyword","arguments","that","override","the",":","class",":","`","torch_geometric.loader.NeighborLoader","`","configuration","during","evaluation",".","(","default",":",":","obj",":","`","None","`",")","*","*","kwargs","(","optional",")",":","Additional","arguments","of",":","class",":","`","torch_geometric.loader.NeighborLoader","`","."]
code: def train_dataloader(self) -> torch.utils.data.DataLoader:
      return self.dataloader(
          self.input_train_nodes,
          self.input_train_time,
          self.input_train_id,
          node_sampler=getattr(self, "graph_sampler", None),
          shuffle=self.train_shuffle,
          **self.loader_kwargs,
      )
  
imports: import copy
  import inspect
  import warnings
  from typing import Any, Dict, Optional, Tuple, Type, Union
  import torch
  from torch_geometric.data import Data, Dataset, HeteroData
  from torch_geometric.loader import DataLoader, LinkLoader, NodeLoader
  from torch_geometric.sampler import BaseSampler, NeighborSampler
  from torch_geometric.typing import InputEdges, InputNodes, OptTensor
label_desc: Use image node_id 3 for calling the LightningNodeData obj's underlying member method code with example usage: obj.train_dataloader() and returns: self