code: def data_generator(
      x: Union[Data, Iterator[Data]]
  ) -> Iterator[list[np.ndarray]]:
      if isinstance(x, np.ndarray):
          for inputs in x:
              yield [np.expand_dims(inputs, axis=0)]
      elif isinstance(x, list):
          for inputs in zip(*x):
              yield [np.expand_dims(inp, axis=0) for inp in inputs]
      elif hasattr(x, "__next__") and hasattr(x, "__iter__"):
          for inputs in x:
              if isinstance(inputs, np.ndarray):
                  yield [np.expand_dims(inputs, axis=0)]
              else:
                  yield [np.expand_dims(inp, axis=0) for inp in inputs]
      else:
          raise ValueError(
              "Expected either a list of inputs or a Numpy array with implicit initial "
              f"batch dimension or an iterator yielding one of the above. Received: {x}"
          )
  
file_path: compute-engine/larq_compute_engine/tflite/python/interpreter_base.py
imports: from collections.abc import Iterator
  from typing import Union, Optional
  import numpy
  from tqdm import tqdm
label_desc: Use image node_id 1 for calling a global function with example usage: data_generator(x) without return types