class_docstr: Represent a single graph with additional attributes.
class_docstr_tok: ["Represent","a","single","graph","with","additional","attributes","."]
docstr: Convert a tensor from [N, *] to [B, N_max, *] with zero padding according
  to the batch information stored in the graph.
  
  Parameters
  ----------
  input_tensor : torch.Tensor
  The original tensor to be split.
  type : str
  'node' or 'edge'. Indicates the source of batch information.
  
  Returns
  -------
  torch.Tensor
  The split tensor.
code: def split_features(
      self, input_tensor: torch.Tensor, type: str = "node"
  ) -> torch.Tensor:
      """
      Convert a tensor from [N, *] to [B, N_max, *] with zero padding according
      to the batch information stored in the graph.
  
      Parameters
      ----------
      input_tensor : torch.Tensor
      The original tensor to be split.
      type : str
      'node' or 'edge'. Indicates the source of batch information.
  
      Returns
      -------
      torch.Tensor
      The split tensor.
      """
      input_tensor = input_tensor.to(self.device)
      if not self._is_batch:
          raise Exception(
              "Cannot invoke `batch_split` method on a non-batch graph."
          )
      # assert self._is_batch, "Cannot invoke `batch_split` method on a non-batch graph."
      if type == "node":
          info_src = self._batch_num_nodes
      elif type == "edge":
          info_src = self._batch_num_edges
      else:
          raise NotImplementedError(
              "Currently only 'node' and 'edge' is accepted in GraphData.split_features()."
          )
      num_instance = 0
      for number in info_src:
          num_instance += number
      if not (num_instance == input_tensor.shape[0]):
          raise SizeMismatchException(
              "Number of instances "
              "doesn't match: The graph "
              "has {} instances while the input "
              "contains {}".format(num_instance, input_tensor.shape[0])
          )
      n_max = max(info_src)
      output = torch.zeros(
          size=(self.batch_size, n_max, *input_tensor.shape[1:])
      ).to(self.device)
      split_input = torch.split(
          tensor=input_tensor, split_size_or_sections=info_src
      )
      for i in range(self.batch_size):
          output[i, : info_src[i]] = split_input[i]
      return output
  
imports: import os
  import warnings
  from collections import namedtuple
  from typing import Any, Callable, Dict, List, Tuple, Union
  import dgl
  import scipy.sparse
  import torch
  from torch.nn.utils.rnn import pad_sequence
  from .utils import EdgeNotFoundException, SizeMismatchException, check_and_expand, entail_zero_padding, int_to_list, slice_to_list
  from .views import BatchEdgeFeatView, BatchNodeFeatView, EdgeView, NodeFeatView, NodeView
label_desc: Use image node_id 40 for calling the GraphData obj's underlying member method code with example usage: obj.split_features(input_tensor, type) and returns: output