






import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple

import numpy as np

from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy


if is_flax_available():
	import jax.numpy as jnp



class 							SCREAMING_SNAKE_CASE__						(    UpperCamelCase_						):





					"""simple docstring"""






					def __get__( self					:  Dict							,		__A					:  int							,		__A					:  List[str]=None	):
						# See docs.python.org/3/howto/descriptor.html#properties
						if obj is None:
							return self
						if self.fget is None:
							raise AttributeError("unreadable attribute"	)
						snake_case__			:				Optional[int]       =  "__cached_" + self.fget.__name__
						snake_case__			:				int       =  getattr(__A							,		__A							,		__A	)
						if cached is None:
							snake_case__			:				Union[str, Any]       =  self.fget(__A	)
							setattr(__A							,		__A							,		__A	)
						return cached







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							str       ):
	snake_case__			:				Tuple       =  val.lower()
	if val in {"y", "yes", "t", "true", "on", "1"}:
		return 1
	if val in {"n", "no", "f", "false", "off", "0"}:
		return 0
	raise ValueError(F'''invalid truth value {val!r}'''       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							List[Any]       ):
	if is_torch_fx_proxy(snake_case_       ):
		return True
	if is_torch_available():
		import torch

		if isinstance(snake_case_					,  torch.Tensor       ):
			return True
	if is_tf_available():
		import tensorflow as tf

		if isinstance(snake_case_					,  tf.Tensor       ):
			return True

	if is_flax_available():
		import jax.numpy as jnp
		from jax.core import Tracer

		if isinstance(snake_case_					,  (jnp.ndarray, Tracer)       ):
			return True

	return isinstance(snake_case_					,  np.ndarray       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Tuple       ):
	return isinstance(snake_case_					,  np.ndarray       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Any       ):
	return _is_numpy(snake_case_       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Optional[int]       ):
	import torch

	return isinstance(snake_case_					,  torch.Tensor       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							str       ):
	return False if not is_torch_available() else _is_torch(snake_case_       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Dict       ):
	import torch

	return isinstance(snake_case_					,  torch.device       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Union[str, Any]       ):
	return False if not is_torch_available() else _is_torch_device(snake_case_       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							List[Any]       ):
	import torch

	if isinstance(snake_case_					,  snake_case_       ):
		if hasattr(snake_case_					,  snake_case_       ):
			snake_case__			:				Optional[Any]       =  getattr(snake_case_					,  snake_case_       )
		else:
			return False
	return isinstance(snake_case_					,  torch.dtype       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Union[str, Any]       ):
	return False if not is_torch_available() else _is_torch_dtype(snake_case_       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Optional[Any]       ):
	import tensorflow as tf

	return isinstance(snake_case_					,  tf.Tensor       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Optional[Any]       ):
	return False if not is_tf_available() else _is_tensorflow(snake_case_       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Union[str, Any]       ):
	import tensorflow as tf

	# the `is_symbolic_tensor` predicate is only available starting with TF 2.14
	if hasattr(snake_case_					,  "is_symbolic_tensor"       ):
		return tf.is_symbolic_tensor(snake_case_       )
	return type(snake_case_       ) == tf.Tensor







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Optional[int]       ):
	return False if not is_tf_available() else _is_tf_symbolic_tensor(snake_case_       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Union[str, Any]       ):
	import jax.numpy as jnp  # noqa: F811

	return isinstance(snake_case_					,  jnp.ndarray       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Optional[Any]       ):
	return False if not is_flax_available() else _is_jax(snake_case_       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							int       ):
	if isinstance(snake_case_					,  (dict, UserDict)       ):
		return {k: to_py_obj(snake_case_       ) for k, v in obj.items()}
	elif isinstance(snake_case_					,  (list, tuple)       ):
		return [to_py_obj(snake_case_       ) for o in obj]
	elif is_tf_tensor(snake_case_       ):
		return obj.numpy().tolist()
	elif is_torch_tensor(snake_case_       ):
		return obj.detach().cpu().tolist()
	elif is_jax_tensor(snake_case_       ):
		return np.asarray(snake_case_       ).tolist()
	elif isinstance(snake_case_					,  (np.ndarray, np.number)       ):  # tolist also works on 0d np arrays
		return obj.tolist()
	else:
		return obj







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Union[str, Any]       ):
	if isinstance(snake_case_					,  (dict, UserDict)       ):
		return {k: to_numpy(snake_case_       ) for k, v in obj.items()}
	elif isinstance(snake_case_					,  (list, tuple)       ):
		return np.array(snake_case_       )
	elif is_tf_tensor(snake_case_       ):
		return obj.numpy()
	elif is_torch_tensor(snake_case_       ):
		return obj.detach().cpu().numpy()
	elif is_jax_tensor(snake_case_       ):
		return np.asarray(snake_case_       )
	else:
		return obj



class 							SCREAMING_SNAKE_CASE__						(    UpperCamelCase_						):





					"""simple docstring"""






					def 	_lowercase					( self					:  Optional[Any]	):
						snake_case__			:				Dict       =  fields(self	)

						# Safety and consistency checks
						if not len(__A	):
							raise ValueError(f'''{self.__class__.__name__} has no fields.'''	)
						if not all(field.default is None for field in class_fields[1:]	):
							raise ValueError(f'''{self.__class__.__name__} should not have more than one required field.'''	)

						snake_case__			:				Union[str, Any]       =  getattr(self							,		class_fields[0].name	)
						snake_case__			:				Optional[int]       =  all(getattr(self							,		field.name	) is None for field in class_fields[1:]	)

						if other_fields_are_none and not is_tensor(__A	):
							if isinstance(__A							,		__A	):
								snake_case__			:				Optional[int]       =  first_field.items()
								snake_case__			:				Optional[int]       =  True
							else:
								try:
									snake_case__			:				Union[str, Any]       =  iter(__A	)
									snake_case__			:				int       =  True
								except TypeError:
									snake_case__			:				Optional[int]       =  False

            # if we provided an iterator as first field and the iterator is a (key, value) iterator
            # set the associated fields
							if first_field_iterator:
								for idx, element in enumerate(__A	):
									if (
									    not isinstance(__A							,		(list, tuple)	)
									    or not len(__A	) == 2
									    or not isinstance(element[0]							,		__A	)
									):
										if idx == 0:
											# If we do not have an iterator of key/values, set it as attribute
											snake_case__			:				Optional[int]       =  first_field
										else:
											# If we have a mixed iterator, raise an error
											raise ValueError(
											    f'''Cannot set key/value for {element}. It needs to be a tuple (key, value).'''	)
										break
									setattr(self							,		element[0]							,		element[1]	)
									if element[1] is not None:
										snake_case__			:				Optional[int]       =  element[1]
							elif first_field is not None:
								snake_case__			:				Optional[Any]       =  first_field
						else:
							for field in class_fields:
								snake_case__			:				int       =  getattr(self							,		field.name	)
								if v is not None:
									snake_case__			:				Optional[Any]       =  v



					def __delitem__( self					:  Optional[Any]							,		*__A					:  Union[str, Any]							,		**__A					:  Any	):
						raise Exception(f'''You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.'''	)



					def 	_lowercase					( self					:  Any							,		*__A					:  Union[str, Any]							,		**__A					:  Tuple	):
						raise Exception(f'''You cannot use ``setdefault`` on a {self.__class__.__name__} instance.'''	)



					def 	_lowercase					( self					:  str							,		*__A					:  int							,		**__A					:  Optional[int]	):
						raise Exception(f'''You cannot use ``pop`` on a {self.__class__.__name__} instance.'''	)



					def 	_lowercase					( self					:  Optional[Any]							,		*__A					:  List[Any]							,		**__A					:  Any	):
						raise Exception(f'''You cannot use ``update`` on a {self.__class__.__name__} instance.'''	)



					def __getitem__( self					:  Union[str, Any]							,		__A					:  List[Any]	):
						if isinstance(__A							,		__A	):
							snake_case__			:				List[Any]       =  dict(self.items()	)
							return inner_dict[k]
						else:
							return self.to_tuple()[k]



					def __setattr__( self					:  Tuple							,		__A					:  Tuple							,		__A					:  List[str]	):
						if name in self.keys() and value is not None:
							# Don't call self.__setitem__ to avoid recursion errors
							super().__setitem__(__A							,		__A	)
						super().__setattr__(__A							,		__A	)



					def __setitem__( self					:  List[str]							,		__A					:  Optional[Any]							,		__A					:  Dict	):
						# Will raise a KeyException if needed
						super().__setitem__(__A							,		__A	)
						# Don't call self.__setattr__ to avoid recursion errors
						super().__setattr__(__A							,		__A	)






					def 	_lowercase					( self					:  str	):
						return tuple(self[k] for k in self.keys()	)



class 							SCREAMING_SNAKE_CASE__						(    UpperCamelCase_			,       UpperCamelCase_						):





					"""simple docstring"""






					@classmethod
					def 	_lowercase					( cls					:  int							,		__A					:  str	):
						raise ValueError(
						    f'''{value} is not a valid {cls.__name__}, please select one of {list(cls._valueamember_map_.keys()	)}'''	)



class 							SCREAMING_SNAKE_CASE__						(    UpperCamelCase_						):





					"""simple docstring"""






					a_     =		"longest"
					a_     =		"max_length"
					a_     =		"do_not_pad"



class 							SCREAMING_SNAKE_CASE__						(    UpperCamelCase_						):





					"""simple docstring"""






					a_     =		"pt"
					a_     =		"tf"
					a_     =		"np"
					a_     =		"jax"



class 							SCREAMING_SNAKE_CASE__						:





					"""simple docstring"""






					def __init__( self					:  str							,		__A					:  List[ContextManager]	):
						snake_case__			:				str       =  context_managers
						snake_case__			:				Optional[Any]       =  ExitStack()



					def __enter__( self					:  List[str]	):
						for context_manager in self.context_managers:
							self.stack.enter_context(__A	)






					def __exit__( self					:  Optional[Any]							,		*__A					:  Union[str, Any]							,		**__A					:  Optional[Any]	):
						self.stack.__exit__(*__A							,		**__A	)







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Optional[Any]       ):
	snake_case__			:				Optional[Any]       =  infer_framework(snake_case_       )
	if framework == "tf":
		snake_case__			:				Union[str, Any]       =  inspect.signature(model_class.call       )  # TensorFlow models
	elif framework == "pt":
		snake_case__			:				Optional[int]       =  inspect.signature(model_class.forward       )  # PyTorch models
	else:
		snake_case__			:				Union[str, Any]       =  inspect.signature(model_class.__call__       )  # Flax models

	for p in signature.parameters:
		if p == "return_loss" and signature.parameters[p].default is True:
			return True

	return False







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Tuple       ):
	snake_case__			:				List[Any]       =  model_class.__name__
	snake_case__			:				Any       =  infer_framework(snake_case_       )
	if framework == "tf":
		snake_case__			:				Tuple       =  inspect.signature(model_class.call       )  # TensorFlow models
	elif framework == "pt":
		snake_case__			:				Optional[Any]       =  inspect.signature(model_class.forward       )  # PyTorch models
	else:
		snake_case__			:				List[Any]       =  inspect.signature(model_class.__call__       )  # Flax models

	if "QuestionAnswering" in model_name:
		return [p for p in signature.parameters if "label" in p or p in ("start_positions", "end_positions")]
	else:
		return [p for p in signature.parameters if "label" in p]







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							MutableMapping					,  snake_case_ :							str = ""					,  snake_case_ :							str = "."       ):

	def _flatten_dict(snake_case_ :							List[str]					,  snake_case_ :							str=""					,  snake_case_ :							int="."       ):
		for k, v in d.items():
			snake_case__			:				Optional[int]       =  str(snake_case_       ) + delimiter + str(snake_case_       ) if parent_key else k
			if v and isinstance(snake_case_					,  snake_case_       ):
				yield from flatten_dict(snake_case_					,  snake_case_					,  delimiter=snake_case_       ).items()
			else:
				yield key, v

	return dict(_flatten_dict(snake_case_					,  snake_case_					,  snake_case_       )       )







@contextmanager
def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							List[Any]					,  snake_case_ :							bool = False       ):
	if use_temp_dir:
		with tempfile.TemporaryDirectory() as tmp_dir:
			yield tmp_dir
	else:
		yield working_dir







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							int					,  snake_case_ :							str=None       ):
	if is_numpy_array(snake_case_       ):
		return np.transpose(snake_case_					,  axes=snake_case_       )
	elif is_torch_tensor(snake_case_       ):
		return array.T if axes is None else array.permute(*snake_case_       )
	elif is_tf_tensor(snake_case_       ):
		import tensorflow as tf

		return tf.transpose(snake_case_					,  perm=snake_case_       )
	elif is_jax_tensor(snake_case_       ):
		return jnp.transpose(snake_case_					,  axes=snake_case_       )
	else:
		raise ValueError(F'''Type not supported for transpose: {type(snake_case_       )}.'''       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							List[Any]					,  snake_case_ :							List[Any]       ):
	if is_numpy_array(snake_case_       ):
		return np.reshape(snake_case_					,  snake_case_       )
	elif is_torch_tensor(snake_case_       ):
		return array.reshape(*snake_case_       )
	elif is_tf_tensor(snake_case_       ):
		import tensorflow as tf

		return tf.reshape(snake_case_					,  snake_case_       )
	elif is_jax_tensor(snake_case_       ):
		return jnp.reshape(snake_case_					,  snake_case_       )
	else:
		raise ValueError(F'''Type not supported for reshape: {type(snake_case_       )}.'''       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Union[str, Any]					,  snake_case_ :							Tuple=None       ):
	if is_numpy_array(snake_case_       ):
		return np.squeeze(snake_case_					,  axis=snake_case_       )
	elif is_torch_tensor(snake_case_       ):
		return array.squeeze() if axis is None else array.squeeze(dim=snake_case_       )
	elif is_tf_tensor(snake_case_       ):
		import tensorflow as tf

		return tf.squeeze(snake_case_					,  axis=snake_case_       )
	elif is_jax_tensor(snake_case_       ):
		return jnp.squeeze(snake_case_					,  axis=snake_case_       )
	else:
		raise ValueError(F'''Type not supported for squeeze: {type(snake_case_       )}.'''       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Tuple					,  snake_case_ :							Union[str, Any]       ):
	if is_numpy_array(snake_case_       ):
		return np.expand_dims(snake_case_					,  snake_case_       )
	elif is_torch_tensor(snake_case_       ):
		return array.unsqueeze(dim=snake_case_       )
	elif is_tf_tensor(snake_case_       ):
		import tensorflow as tf

		return tf.expand_dims(snake_case_					,  axis=snake_case_       )
	elif is_jax_tensor(snake_case_       ):
		return jnp.expand_dims(snake_case_					,  axis=snake_case_       )
	else:
		raise ValueError(F'''Type not supported for expand_dims: {type(snake_case_       )}.'''       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							int       ):
	if is_numpy_array(snake_case_       ):
		return np.size(snake_case_       )
	elif is_torch_tensor(snake_case_       ):
		return array.numel()
	elif is_tf_tensor(snake_case_       ):
		import tensorflow as tf

		return tf.size(snake_case_       )
	elif is_jax_tensor(snake_case_       ):
		return array.size
	else:
		raise ValueError(F'''Type not supported for expand_dims: {type(snake_case_       )}.'''       )







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							int					,  snake_case_ :							List[Any]       ):
	for key, value in auto_map.items():
		if isinstance(snake_case_					,  (tuple, list)       ):
			snake_case__			:				Tuple       =  [F'''{repo_id}--{v}''' if (v is not None and "--" not in v) else v for v in value]
		elif value is not None and "--" not in value:
			snake_case__			:				List[str]       =  F'''{repo_id}--{value}'''

	return auto_map







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Dict       ):
	for base_class in inspect.getmro(snake_case_       ):
		snake_case__			:				Optional[int]       =  base_class.__module__
		snake_case__			:				Union[str, Any]       =  base_class.__name__
		if module.startswith("tensorflow"       ) or module.startswith("keras"       ) or name == "TFPreTrainedModel":
			return "tf"
		elif module.startswith("torch"       ) or name == "PreTrainedModel":
			return "pt"
		elif module.startswith("flax"       ) or module.startswith("jax"       ) or name == "FlaxPreTrainedModel":
			return "flax"
	else:
		raise TypeError(F'''Could not infer framework from class {model_class}.'''       )











from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import rescale, resize, to_channel_dimension_format
from ...image_utils import (
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
	import PIL


__lowerCamelCase :      int										=				logging.get_logger(__name__)







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							int					,  snake_case_ :							Any       ):
	snake_case__			:				List[str]       =  b.T
	snake_case__			:				Union[str, Any]       =  np.sum(np.square(snake_case_       )					,  axis=1       )
	snake_case__			:				Dict       =  np.sum(np.square(snake_case_       )					,  axis=0       )
	snake_case__			:				Dict       =  np.matmul(snake_case_					,  snake_case_       )
	snake_case__			:				Any       =  aa[:, None] - 2 * ab + ba[None, :]
	return d







def 					SCREAMING_SNAKE_CASE    (			snake_case_ :							Optional[int]					,  snake_case_ :							Tuple       ):
	snake_case__			:				Tuple       =  x.reshape(-1					,  3       )
	snake_case__			:				int       =  squared_euclidean_distance(snake_case_					,  snake_case_       )
	return np.argmin(snake_case_					,  axis=1       )





class 							SCREAMING_SNAKE_CASE__						(    UpperCamelCase_						):





					"""simple docstring"""






					a_     =		["pixel_values"]



					def __init__( self					:  str							,		__A					:  Optional[Union[List[List[int]], np.ndarray]] = None							,		__A					:  bool = True							,		__A					:  Dict[str, int] = None							,		__A					:  PILImageResampling = PILImageResampling.BILINEAR							,		__A					:  bool = True							,		__A					:  bool = True							,		**__A					:  Union[str, Any]							,		):
						super().__init__(**__A	)
						snake_case__			:				Optional[int]       =  size if size is not None else {"height": 2_5_6, "width": 2_5_6}
						snake_case__			:				List[Any]       =  get_size_dict(__A	)
						snake_case__			:				Any       =  np.array(__A	) if clusters is not None else None
						snake_case__			:				Optional[Any]       =  do_resize
						snake_case__			:				Any       =  size
						snake_case__			:				List[Any]       =  resample
						snake_case__			:				List[Any]       =  do_normalize
						snake_case__			:				Dict       =  do_color_quantize



					def 	_lowercase					( self					:  List[Any]							,		__A					:  np.ndarray							,		__A					:  Dict[str, int]							,		__A					:  PILImageResampling = PILImageResampling.BILINEAR							,		__A					:  Optional[Union[str, ChannelDimension]] = None							,		**__A					:  int							,		):
						snake_case__			:				List[Any]       =  get_size_dict(__A	)
						if "height" not in size or "width" not in size:
							raise ValueError(f'''Size dictionary must contain both height and width keys. Got {size.keys()}'''	)
						return resize(
						    __A							,		size=(size["height"], size["width"])							,		resample=__A							,		data_format=__A							,		**__A	)



					def 	_lowercase					( self					:  List[Any]							,		__A					:  np.ndarray							,		__A					:  Optional[Union[str, ChannelDimension]] = None							,		):
						snake_case__			:				List[str]       =  rescale(image=__A							,		scale=1 / 1_2_7.5							,		data_format=__A	)
						snake_case__			:				List[Any]       =  image - 1
						return image






					def 	_lowercase					( self					:  Dict							,		__A					:  ImageInput							,		__A					:  bool = None							,		__A					:  Dict[str, int] = None							,		__A					:  PILImageResampling = None							,		__A					:  bool = None							,		__A					:  Optional[bool] = None							,		__A					:  Optional[Union[List[List[int]], np.ndarray]] = None							,		__A					:  Optional[Union[str, TensorType]] = None							,		__A					:  Optional[Union[str, ChannelDimension]] = ChannelDimension.FIRST							,		**__A					:  Optional[int]							,		):
						snake_case__			:				Any       =  do_resize if do_resize is not None else self.do_resize
						snake_case__			:				Union[str, Any]       =  size if size is not None else self.size
						snake_case__			:				Union[str, Any]       =  get_size_dict(__A	)
						snake_case__			:				Optional[Any]       =  resample if resample is not None else self.resample
						snake_case__			:				Tuple       =  do_normalize if do_normalize is not None else self.do_normalize
						snake_case__			:				Optional[Any]       =  do_color_quantize if do_color_quantize is not None else self.do_color_quantize
						snake_case__			:				Union[str, Any]       =  clusters if clusters is not None else self.clusters
						snake_case__			:				Union[str, Any]       =  np.array(__A	)

						snake_case__			:				Any       =  make_list_of_images(__A	)

						if not valid_images(__A	):
							raise ValueError(
							    "Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
							    "torch.Tensor, tf.Tensor or jax.ndarray."	)

						if do_resize and size is None or resample is None:
							raise ValueError("Size and resample must be specified if do_resize is True."	)

						if do_color_quantize and clusters is None:
							raise ValueError("Clusters must be specified if do_color_quantize is True."	)

						# All transformations expect numpy arrays.
						snake_case__			:				Optional[Any]       =  [to_numpy_array(__A	) for image in images]

						if do_resize:
							snake_case__			:				List[str]       =  [self.resize(image=__A							,		size=__A							,		resample=__A	) for image in images]

						if do_normalize:
							snake_case__			:				Union[str, Any]       =  [self.normalize(image=__A	) for image in images]

						if do_color_quantize:
							snake_case__			:				int       =  [to_channel_dimension_format(__A							,		ChannelDimension.LAST	) for image in images]
							# color quantize from (batch_size, height, width, 3) to (batch_size, height, width)
							snake_case__			:				int       =  np.array(__A	)
							snake_case__			:				Dict       =  color_quantize(__A							,		__A	).reshape(images.shape[:-1]	)

							# flatten to (batch_size, height*width)
							snake_case__			:				str       =  images.shape[0]
							snake_case__			:				str       =  images.reshape(__A							,		-1	)

							# We need to convert back to a list of images to keep consistent behaviour across processors.
							snake_case__			:				Union[str, Any]       =  list(__A	)
						else:
							snake_case__			:				Any       =  [to_channel_dimension_format(__A							,		__A	) for image in images]

						snake_case__			:				Optional[int]       =  {"input_ids": images}
						return BatchFeature(data=__A							,		tensor_type=__A	)



