code: def batch_size(X: Tensor) -> int:
      """Return batch size of Tensor as integer."""
      bs: int | None = X.get_shape()[0]
      if isinstance(bs, int):
          return bs
      raise ValueError(
          f"Found non-integer batch_size {bs} for Tensor {X}"
      )
  
imports: from __future__ import annotations
  from typing import TypeVar
  import numpy
  import tensorflow
  import tensorflow.keras.backend
  from innvestigate.backend.types import Layer, OptionalList, ShapeTuple, Tensor
label_desc: Use image node_id 5 for calling a global function with example usage: batch_size(X) and returns: bs