code: def _build_tensor_row(
      row: ArrowRow, col_name: str = TENSOR_COLUMN_NAME
  ) -> np.ndarray:
      from packaging.version import parse as parse_version
  
      element = row[col_name][0]
      # TODO(Clark): Reduce this to np.asarray(element) once we only support Arrow
      # 9.0.0+.
      pyarrow_version = _get_pyarrow_version()
      if pyarrow_version is not None:
          pyarrow_version = parse_version(pyarrow_version)
      if pyarrow_version is None or pyarrow_version >= parse_version(
          "8.0.0"
      ):
          assert isinstance(element, pyarrow.ExtensionScalar)
          if (
              pyarrow_version is None
              or pyarrow_version >= parse_version("9.0.0")
          ):
              # For Arrow 9.0.0+, accessing an element in a chunked tensor array
              # produces an ArrowTensorScalar, which we convert to an ndarray using
              # .as_py().
              element = element.as_py()
          else:
              # For Arrow 8.*, accessing an element in a chunked tensor array produces
              # an ExtensionScalar, which we convert to an ndarray using our custom
              # method.
              element = element.type._extension_scalar_to_ndarray(
                  element
              )
      # For Arrow < 8.0.0, accessing an element in a chunked tensor array produces an
      # ndarray, which we return directly.
      assert isinstance(element, np.ndarray), type(element)
      return element
  
imports: import collections
  import heapq
  import random
  from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Tuple, TypeVar, Union
  import numpy
  from ray._private.utils import _get_pyarrow_version
  from ray.air.constants import TENSOR_COLUMN_NAME
  from ray.data._internal.arrow_ops import transform_polars, transform_pyarrow
  from ray.data._internal.numpy_support import convert_udf_returns_to_numpy, is_valid_udf_return
  from ray.data._internal.table_block import TableBlockAccessor, TableBlockBuilder
  from ray.data._internal.util import _truncated_repr, find_partitions
  from ray.data.block import Block, BlockAccessor, BlockExecStats, BlockMetadata, KeyType, U
  from ray.data.context import DataContext
  from ray.data.row import TableRow
label_desc: Use image node_id 6 for calling the ArrowBlockAccessor obj's underlying member method code with example usage: obj._build_tensor_row(row, col_name) and returns: element