class_docstr: A plain python object modeling a single graph with various
  (optional) attributes:
  
  Args:
      x (Tensor, optional): Node feature matrix with shape :obj:`[num_nodes,
          num_node_features]`. (default: :obj:`None`)
      edge_index (LongTensor, optional): Graph connectivity in COO format
          with shape :obj:`[2, num_edges]`. (default: :obj:`None`)
      edge_attr (Tensor, optional): Edge feature matrix with shape
          :obj:`[num_edges, num_edge_features]`. (default: :obj:`None`)
      y (Tensor, optional): Graph or node targets with arbitrary shape.
          (default: :obj:`None`)
      pos (Tensor, optional): Node position matrix with shape
          :obj:`[num_nodes, num_dimensions]`. (default: :obj:`None`)
  
  The data object is not restricted to these attributes and can be extented
  by any other additional data.
docstr: If the data has masks for train/val/test, return the splits with specific number of samples from every class for training.
  
  Parameters
  ----------
  num_train_per_class : int
      the number of samples from every class used for training.
  
  num_val : int
      the total number of nodes that used for validation.
  
  num_test : int
      the total number of nodes that used for testing.
  
  seed : int
      random seed for splitting dataset.
docstr_tok: ["If","the","data","has","masks","for","train\/val\/test",",","return","the","splits","with","specific","number","of","samples","from","every","class","for","training",".","Parameters","--","--","--","--","--","num_train_per_class",":","int","the","number","of","samples","from","every","class","used","for","training",".","num_val",":","int","the","total","number","of","nodes","that","used","for","validation",".","num_test",":","int","the","total","number","of","nodes","that","used","for","testing",".","seed",":","int","random","seed","for","splitting","dataset","."]
code: def random_splits_mask_class(
      self, num_train_per_class, num_val, num_test, seed=None
  ):
      r"""If the data has masks for train/val/test, return the splits with specific number of samples from every class for training.
  
      Parameters
      ----------
      num_train_per_class : int
          the number of samples from every class used for training.
  
      num_val : int
          the total number of nodes that used for validation.
  
      num_test : int
          the total number of nodes that used for testing.
  
      seed : int
          random seed for splitting dataset.
      """
      rs = torch.get_rng_state()
      rs_cuda = torch.cuda.get_rng_state()
      if seed is not None:
          torch.manual_seed(seed)
          torch.cuda.manual_seed(seed)
  
      num_classes = self.y.max().cpu().item() + 1
      self.train_mask.fill_(False)
      for c in range(num_classes):
          idx = (self.y == c).nonzero().view(-1)
          idx = idx[torch.randperm(idx.size(0))[:num_train_per_class]]
          self.train_mask[idx] = True
  
      remaining = (~self.train_mask).nonzero().view(-1)
      remaining = remaining[torch.randperm(remaining.size(0))]
  
      self.val_mask.fill_(False)
      self.val_mask[remaining[:num_val]] = True
  
      self.test_mask.fill_(False)
      self.test_mask[remaining[num_val : num_val + num_test]] = True
  
      torch.set_rng_state(rs)
      torch.cuda.set_rng_state(rs_cuda)
      return self
  
imports: import re
  import torch
label_desc: Use image node_id 14 for calling the Data obj's underlying member method code with example usage: obj.random_splits_mask_class(num_train_per_class, num_val, num_test, seed) and returns: self