code: 
  
  
  
  """simple docstring"""
  from __future__ import annotations
  
  
  
  
  
  def 				lowerCamelCase_		(UpperCamelCase__	:	str  , UpperCamelCase__	:	Dict  , UpperCamelCase__	:	List[str]							):
  
  
  
  
  
  
      if len(UpperCAmelCase_							) == 0:
          raise ValueError('''find_min() arg is an empty sequence'''							)
      if (
          left >= len(UpperCAmelCase_							)
          or left < -len(UpperCAmelCase_							)
          or right >= len(UpperCAmelCase_							)
          or right < -len(UpperCAmelCase_							)
      ):
          raise IndexError('''list index out of range'''							)
      if left == right:
          return nums[left]
      _UpperCAmelCase							:						Union[str, Any]       							=					(left + right) >> 1  # the middle
      _UpperCAmelCase							:						int       							=					find_min(UpperCAmelCase_  , UpperCAmelCase_  , UpperCAmelCase_							)  # find min in range[left, mid]
      _UpperCAmelCase							:						Any       							=					find_min(UpperCAmelCase_  , mid + 1  , UpperCAmelCase_							)  # find min in range[mid + 1, right]
  
      return left_min if left_min <= right_min else right_min
  
  
  if __name__ == "__main__":
    import doctest
  
    doctest.testmod(verbose=True)
  
  
  
style_context: 
  
  
  
  """simple docstring"""
  # Lint as: python3
  import sys
  from collections.abc import Mapping
  from typing import TYPE_CHECKING
  
  import numpy as np
  import pyarrow as pa
  
  from .. import config
  from ..utils.py_utils import map_nested
  from .formatting import TensorFormatter
  
  
  if TYPE_CHECKING:
    import tensorflow as tf
  class 							_UpperCAmelCase							(				TensorFormatter[Mapping, '''tf.Tensor''', Mapping]   ):
  
  
  
  
  
       '''simple docstring'''
  
  
  
       def __init__(      self ,			A=None ,			**A	)							->      List[str]:
           super().__init__(features=A	)
           _UpperCAmelCase							:						Any       							=					tf_tensor_kwargs
           import tensorflow as tf  # noqa: import tf at initialization
  
  
  
  
  
       def 				__lowerCAmelCase			(      self ,			A	)							->      Optional[Any]:
           import tensorflow as tf
  
           if isinstance(A ,			A	) and column:
               if all(
                   isinstance(A ,			tf.Tensor	) and x.shape == column[0].shape and x.dtype == column[0].dtype for x in column	):
                   return tf.stack(A	)
               elif all(
                   isinstance(A ,			(tf.Tensor, tf.RaggedTensor)	) and x.ndim == 1 and x.dtype == column[0].dtype
                   for x in column	):
                   # only rag 1-D tensors, otherwise some dimensions become ragged even though they were consolidated
                   return tf.ragged.stack(A	)
  
           return column
  
  
  
  
  
       def 				__lowerCAmelCase			(      self ,			A	)							->      int:
           import tensorflow as tf
  
           if value is None:
               return value
  
           _UpperCAmelCase							:						Any       							=					{}
  
           if isinstance(A ,			(np.number, np.ndarray)	) and np.issubdtype(value.dtype ,			np.integer	):
               _UpperCAmelCase							:						Union[str, Any]       							=					{'''dtype''': tf.intaa}
           elif isinstance(A ,			(np.number, np.ndarray)	) and np.issubdtype(value.dtype ,			np.floating	):
               _UpperCAmelCase							:						Dict       							=					{'''dtype''': tf.floataa}
           elif config.PIL_AVAILABLE and "PIL" in sys.modules:
               import PIL.Image
  
               if isinstance(A ,			PIL.Image.Image	):
                   _UpperCAmelCase							:						Optional[int]       							=					np.asarray(A	)
  
           return tf.convert_to_tensor(A ,			**{**default_dtype, **self.tf_tensor_kwargs}	)
  
  
  
  
  
       def 				__lowerCAmelCase			(      self ,			A	)							->      Tuple:
           import tensorflow as tf
  
           # support for torch, tf, jax etc.
           if config.TORCH_AVAILABLE and "torch" in sys.modules:
               import torch
  
               if isinstance(A ,			torch.Tensor	):
                   return self._tensorize(data_struct.detach().cpu().numpy()[()]	)
           if hasattr(A ,			'''__array__'''	) and not isinstance(A ,			tf.Tensor	):
               _UpperCAmelCase							:						List[str]       							=					data_struct.__array__()
           # support for nested types like struct of list of struct
           if isinstance(A ,			np.ndarray	):
               if data_struct.dtype == object:  # tf tensors cannot be instantied from an array of objects
                   return self._consolidate([self.recursive_tensorize(A	) for substruct in data_struct]	)
           elif isinstance(A ,			(list, tuple)	):
               return self._consolidate([self.recursive_tensorize(A	) for substruct in data_struct]	)
           return self._tensorize(A	)
  
  
  
  
  
       def 				__lowerCAmelCase			(      self ,			A	)							->      Optional[int]:
           return map_nested(self._recursive_tensorize ,			A ,			map_list=A	)
  
  
  
  
  
       def 				__lowerCAmelCase			(      self ,			A	)							->      Mapping:
           _UpperCAmelCase							:						str       							=					self.numpy_arrow_extractor().extract_row(A	)
           _UpperCAmelCase							:						List[Any]       							=					self.python_features_decoder.decode_row(A	)
           return self.recursive_tensorize(A	)
  
  
  
  
  
       def 				__lowerCAmelCase			(      self ,			A	)							->      "tf.Tensor":
           _UpperCAmelCase							:						Union[str, Any]       							=					self.numpy_arrow_extractor().extract_column(A	)
           _UpperCAmelCase							:						Tuple       							=					self.python_features_decoder.decode_column(A ,			pa_table.column_names[0]	)
           _UpperCAmelCase							:						str       							=					self.recursive_tensorize(A	)
           _UpperCAmelCase							:						Optional[Any]       							=					self._consolidate(A	)
           return column
  
  
  
  
  
       def 				__lowerCAmelCase			(      self ,			A	)							->      Mapping:
           _UpperCAmelCase							:						Dict       							=					self.numpy_arrow_extractor().extract_batch(A	)
           _UpperCAmelCase							:						Tuple       							=					self.python_features_decoder.decode_batch(A	)
           _UpperCAmelCase							:						Union[str, Any]       							=					self.recursive_tensorize(A	)
           for column_name in batch:
               _UpperCAmelCase							:						str       							=					self._consolidate(batch[column_name]	)
           return batch
  
  
  