class_docstr: A data object composed by a stream of events describing a temporal
  graph.
  The :class:`~torch_geometric.data.TemporalData` object can hold a list of
  events (that can be understood as temporal edges in a graph) with
  structured messages.
  An event is composed by a source node, a destination node, a timestamp
  and a message. Any *Continuous-Time Dynamic Graph* (CTDG) can be
  represented with these four values.
  
  In general, :class:`~torch_geometric.data.TemporalData` tries to mimic
  the behavior of a regular :python:`Python` dictionary.
  In addition, it provides useful functionality for analyzing graph
  structures, and provides basic PyTorch tensor functionalities.
  
  .. code-block:: python
  
      from torch import Tensor
      from torch_geometric.data import TemporalData
  
      events = TemporalData(
          src=Tensor([1,2,3,4]),
          dst=Tensor([2,3,4,5]),
          t=Tensor([1000,1010,1100,2000]),
          msg=Tensor([1,1,0,0])
      )
  
      # Add additional arguments to `events`:
      events.y = Tensor([1,1,0,0])
  
      # It is also possible to set additional arguments in the constructor
      events = TemporalData(
          ...,
          y=Tensor([1,1,0,0])
      )
  
      # Get the number of events:
      events.num_events
      >>> 4
  
      # Analyzing the graph structure:
      events.num_nodes
      >>> 5
  
      # PyTorch tensor functionality:
      events = events.pin_memory()
      events = events.to('cuda:0', non_blocking=True)
  
  Args:
      src (torch.Tensor, optional): A list of source nodes for the events
          with shape :obj:`[num_events]`. (default: :obj:`None`)
      dst (torch.Tensor, optional): A list of destination nodes for the
          events with shape :obj:`[num_events]`. (default: :obj:`None`)
      t (torch.Tensor, optional): The timestamps for each event with shape
          :obj:`[num_events]`. (default: :obj:`None`)
      msg (torch.Tensor, optional): Messages feature matrix with shape
          :obj:`[num_events, num_msg_features]`. (default: :obj:`None`)
      **kwargs (optional): Additional attributes.
  
  .. note::
      The shape of :obj:`src`, :obj:`dst`, :obj:`t` and the first dimension
      of :obj`msg` should be the same (:obj:`num_events`).
class_docstr_tok: ["A","data","object","composed","by","a","stream","of","events","describing","a","temporal","graph",".","The",":","class",":","`","~torch_geometric.data.TemporalData","`","object","can","hold","a","list","of","events","(","that","can","be","understood","as","temporal","edges","in","a","graph",")","with","structured","messages",".","An","event","is","composed","by","a","source","node",",","a","destination","node",",","a","timestamp","and","a","message",".","Any","*","Continuous-Time","Dynamic","Graph","*","(","CTDG",")","can","be","represented","with","these","four","values",".","In","general",",",":","class",":","`","~torch_geometric.data.TemporalData","`","tries","to","mimic","the","behavior","of","a","regular",":","python",":","`","Python","`","dictionary",".","In","addition",",","it","provides","useful","functionality","for","analyzing","graph","structures",",","and","provides","basic","PyTorch","tensor","functionalities",".","..","code-block",":",":","python","from","torch","import","Tensor","from","torch_geometric.data","import","TemporalData","events","=","TemporalData","(","src=Tensor","(","[","1,2,3,4","]",")",",","dst=Tensor","(","[","2,3,4,5","]",")",",","t=Tensor","(","[","1000,1010,1100,2000","]",")",",","msg=Tensor","(","[","1,1,0,0","]",")",")","#","Add","additional","arguments","to","`","events","`",":","events.y","=","Tensor","(","[","1,1,0,0","]",")","#","It","is","also","possible","to","set","additional","arguments","in","the","constructor","events","=","TemporalData","(","...",",","y=Tensor","(","[","1,1,0,0","]",")",")","#","Get","the","number","of","events",":","events.num_events",">",">",">","4","#","Analyzing","the","graph","structure",":","events.num_nodes",">",">",">","5","#","PyTorch","tensor","functionality",":","events","=","events.pin_memory","(",")","events","=","events.to","(","'cuda:0","'",",","non_blocking=True",")","Args",":","src","(","torch.Tensor",",","optional",")",":","A","list","of","source","nodes","for","the","events","with","shape",":","obj",":","`","[","num_events","]","`",".","(","default",":",":","obj",":","`","None","`",")","dst","(","torch.Tensor",",","optional",")",":","A","list","of","destination","nodes","for","the","events","with","shape",":","obj",":","`","[","num_events","]","`",".","(","default",":",":","obj",":","`","None","`",")","t","(","torch.Tensor",",","optional",")",":","The","timestamps","for","each","event","with","shape",":","obj",":","`","[","num_events","]","`",".","(","default",":",":","obj",":","`","None","`",")","msg","(","torch.Tensor",",","optional",")",":","Messages","feature","matrix","with","shape",":","obj",":","`","[","num_events",",","num_msg_features","]","`",".","(","default",":",":","obj",":","`","None","`",")","*","*","kwargs","(","optional",")",":","Additional","attributes",".","..","note",":",":","The","shape","of",":","obj",":","`","src","`",",",":","obj",":","`","dst","`",",",":","obj",":","`","t","`","and","the","first","dimension","of",":","obj","`","msg","`","should","be","the","same","(",":","obj",":","`","num_events","`",")","."]
docstr: Splits the data in training, validation and test sets according to
  time.
  
  Args:
      val_ratio (float, optional): The proportion (in percents) of the
          dataset to include in the validation split.
          (default: :obj:`0.15`)
      test_ratio (float, optional): The proportion (in percents) of the
          dataset to include in the test split. (default: :obj:`0.15`)
docstr_tok: ["Splits","the","data","in","training",",","validation","and","test","sets","according","to","time",".","Args",":","val_ratio","(","float",",","optional",")",":","The","proportion","(","in","percents",")","of","the","dataset","to","include","in","the","validation","split",".","(","default",":",":","obj",":","`","0.15","`",")","test_ratio","(","float",",","optional",")",":","The","proportion","(","in","percents",")","of","the","dataset","to","include","in","the","test","split",".","(","default",":",":","obj",":","`","0.15","`",")"]
code: def train_val_test_split(
      self, val_ratio: float = 0.15, test_ratio: float = 0.15
  ):
      r"""Splits the data in training, validation and test sets according to
      time.
  
      Args:
          val_ratio (float, optional): The proportion (in percents) of the
              dataset to include in the validation split.
              (default: :obj:`0.15`)
          test_ratio (float, optional): The proportion (in percents) of the
              dataset to include in the test split. (default: :obj:`0.15`)
      """
      val_time, test_time = np.quantile(
          self.t.cpu().numpy(),
          [1.0 - val_ratio - test_ratio, 1.0 - test_ratio],
      )
  
      val_idx = int((self.t <= val_time).sum())
      test_idx = int((self.t <= test_time).sum())
  
      return self[:val_idx], self[val_idx:test_idx], self[test_idx:]
  
imports: import copy
  from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  from torch_geometric.data.data import BaseData, size_repr
  from torch_geometric.data.storage import BaseStorage, EdgeStorage, GlobalStorage, NodeStorage
label_desc: Use image node_id 30 for calling the TemporalData obj's underlying member method code with example usage: obj.train_val_test_split(val_ratio, test_ratio) and returns: self,  self,  self