class_docstr: A plain python object modeling a heterogeneous graph with various
  attributes (Node types in :class:`HeteroGraph` require string type).
  
  Args:
      G (:class:`networkx.classes.graph`): A NetworkX graph object which
          contains features and labels for each node type and edge type.
      **kwargs: Keyworded argument list with keys such
          as :obj:`"node_feature"`, :obj:`"node_label"` and
          corresponding attributes.
class_docstr_tok: ["A","plain","python","object","modeling","a","heterogeneous","graph","with","various","attributes","(","Node","types","in",":","class",":","`","HeteroGraph","`","require","string","type",")",".","Args",":","G","(",":","class",":","`","networkx.classes.graph","`",")",":","A","NetworkX","graph","object","which","contains","features","and","labels","for","each","node","type","and","edge","type",".","*","*","kwargs",":","Keyworded","argument","list","with","keys","such","as",":","obj",":","`","``","node_feature","''","`",",",":","obj",":","`","``","node_label","''","`","and","corresponding","attributes","."]
docstr: Return number of nodes for one node type or for a list of node types.
  
  Args:
      node_type (str or list): Specified node type(s).
  
  Returns:
      int or dict: The number of nodes for a node type or for list of
      node types.
docstr_tok: ["Return","number","of","nodes","for","one","node","type","or","for","a","list","of","node","types",".","Args",":","node_type","(","str","or","list",")",":","Specified","node","type","(","s",")",".","Returns",":","int","or","dict",":","The","number","of","nodes","for","a","node","type","or","for","list","of","node","types","."]
code: def num_nodes(self, node_type: Union[str, List[str]] = None):
      r"""
      Return number of nodes for one node type or for a list of node types.
  
      Args:
          node_type (str or list): Specified node type(s).
  
      Returns:
          int or dict: The number of nodes for a node type or for list of
          node types.
      """
      if node_type is None:
          node_type = self.node_types
      if (
          isinstance(node_type, str)
          or isinstance(node_type, int)
          or isinstance(node_type, float)
      ):
          if node_type in self[self._node_related_key]:
              return len(self[self._node_related_key][node_type])
          else:
              raise ValueError(
                  "Node type does not exist in stored node feature."
              )
      if isinstance(node_type, list):
          if not all(
              node_type_i in self[self._node_related_key]
              for node_type_i in node_type
          ):
              raise ValueError(
                  "Some node types do not exist in stored node feature."
              )
          else:
              num_nodes_dict = {}
              for node_type_i in node_type:
                  num_nodes_dict[node_type_i] = len(
                      self[self._node_related_key][node_type_i]
                  )
              return num_nodes_dict
      else:
          raise TypeError("Node types have unexpected type.")
  
imports: import math
  import copy
  import random
  import torch
  import networkx
  import numpy
  from deepsnap.graph import Graph
  from typing import Dict, List, Union
  import warnings
label_desc: Use image node_id 5 for calling the HeteroGraph obj's underlying member method code with example usage: obj.num_nodes(node_type) and returns: len, num_nodes_dict