code: def tensors_to_numpy(tensors, dtype=None):
      """Convert tf Tensor(s) to numpy ndarray(s)."""
      if isinstance(dtype, tf.DType):
          dtype = dtype.as_numpy_dtype
      if isinstance(tensors, (list, tuple)):
          return type(tensors)(
              tensors_to_numpy(tensor, dtype) for tensor in tensors
          )
      elif isinstance(tensors, dict):
          return {
              key: tensors_to_numpy(value, dtype)
              for key, value in tensors.items()
          }
      elif isinstance(tensors, tf.Tensor):
          if dtype is None:
              return tensors.numpy()
          else:
              return tensors.numpy().astype(dtype)
      elif isinstance(tensors, np.ndarray) and dtype is not None:
          return tensors.astype(dtype)
      else:
          return tensors
  
file_path: BigDL/python/nano/src/bigdl/nano/utils/tf/data.py
imports: from typing import Union, Optional, Sequence, Dict
  import numpy
  import tensorflow
  from bigdl.nano.utils.common import invalidInputError
label_desc: Use image node_id 5 for calling a global function with example usage: tensors_to_numpy(tensors, dtype) and returns: type, unknown, tensors, tensors, tensors, tensors