code: def data_length(data):
      x = data["x"]
      if isinstance(x, np.ndarray):
          return x.shape[0]
      else:
          return x[0].shape[0]
  
file_path: BigDL/python/orca/src/bigdl/orca/learn/tf2/estimator.py
imports: import logging
  import numpy
  from bigdl.orca.learn.utils import get_latest_checkpoint
  from bigdl.dllib.utils.log4Error import invalidInputError
  from typing import TYPE_CHECKING, Dict, Union, Callable, Optional, Any
label_desc: Use image node_id 2 for calling a global function with example usage: data_length(data) and returns: x, x