code: def _is_tensor_col(data: Union[pd.Series, pd.DataFrame]) -> bool:
      if isinstance(data, pd.Series):
          return data.dtype == np.object_ and isinstance(
              data.iloc[0], (np.ndarray, list)
          )
      elif isinstance(data, pd.DataFrame):
          return any(data.dtypes == np.object_) and any(
              [isinstance(d, (np.ndarray, list)) for d in data.iloc[0]]
          )
      else:
          raise ValueError(
              "Unexpected data type: {}, expected pd.Series or pd.DataFrame.".format(
                  type(data)
              )
          )
  
file_path: spark/python/pyspark/ml/functions.py
imports: from __future__ import annotations
  import inspect
  import uuid
  from typing import Any, Callable, Iterator, List, Mapping, TYPE_CHECKING, Tuple, Union, Optional
  import numpy
  from pyspark import SparkContext
  from pyspark.sql.functions import pandas_udf
  from pyspark.sql.column import Column, _to_java_column
  from pyspark.sql.types import ArrayType, ByteType, DataType, DoubleType, FloatType, IntegerType, LongType, ShortType, StringType, StructType
  from pyspark.ml.util import try_remote_functions
label_desc: Use image node_id 4 for calling a global function with example usage: _is_tensor_col(data) and returns: unknown, unknown