





import inspect

import jax
import jax.lax as lax
import jax.numpy as jnp

from ..utils import add_start_docstrings
from ..utils.logging import get_logger


__lowercase       :Optional[Any]       =  get_logger(__name__)


__lowercase       :str       =  r"\n    Args:\n        input_ids (`jnp.ndarray` of shape `(batch_size, sequence_length)`):\n            Indices of input sequence tokens in the vocabulary.\n\n            Indices can be obtained using [`PreTrainedTokenizer`]. See [`PreTrainedTokenizer.encode`] and\n            [`PreTrainedTokenizer.__call__`] for details.\n\n            [What are input IDs?](../glossary#input-ids)\n        scores (`jnp.ndarray` of shape `(batch_size, config.vocab_size)`):\n            Prediction scores of a language modeling head. These can be logits for each vocabulary when not using beam\n            search or log softmax for each vocabulary token when using beam search\n        kwargs (`Dict[str, Any]`, *optional*):\n            Additional logits processor specific kwargs.\n\n    Return:\n        `jnp.ndarray` of shape `(batch_size, config.vocab_size)`: The processed prediction scores.\n\n"



class    _a     :






							"""simple docstring"""

							@add_start_docstrings(lowercase_    )
							def __call__(      self				:     List[Any]							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray    )	->jnp.ndarray:
													raise NotImplementedError(
													    f"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""    )







class    _a     :






							"""simple docstring"""

							@add_start_docstrings(lowercase_    )
							def __call__(      self				:     Tuple							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray    )	->jnp.ndarray:
													raise NotImplementedError(
													    f"""{self.__class__} is an abstract class. Only classes inheriting this class can be called."""    )







class    _a     (				lowercase__							):






							"""simple docstring"""

							@add_start_docstrings(lowercase_    )
							def __call__(      self				:     Optional[int]							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int							,	**a				:     Dict    )	->jnp.ndarray:







													for processor in self:
																			SCREAMING_SNAKE_CASE__     :				int   =					inspect.signature(processor.__call__    ).parameters
																			if len(lowercase_    ) > 3:
																									if not all(arg in kwargs for arg in list(function_args.keys()    )[2:]    ):
																															raise ValueError(
																															    f"""Make sure that all the required parameters: {list(function_args.keys()    )} for """
																															    f"""{processor.__class__} are passed to the logits processor."""    )
																									SCREAMING_SNAKE_CASE__     :				List[Any]   =					processor(lowercase_							,	lowercase_							,	lowercase_							,	**lowercase_    )
																			else:
																									SCREAMING_SNAKE_CASE__     :				str   =					processor(lowercase_							,	lowercase_							,	lowercase_    )
													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     Union[str, Any]							,	a				:     float    )	->Tuple:







													if not isinstance(lowercase_							,	lowercase_    ) or not (temperature > 0):
																			raise ValueError(f"""`temperature` has to be a strictly positive float, but is {temperature}"""    )

													SCREAMING_SNAKE_CASE__     :				Any   =					temperature






							def __call__(      self				:     Any							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					scores / self.temperature
													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     List[str]							,	a				:     float							,	a				:     float = -float("Inf"    )							,	a				:     int = 1    )	->Optional[Any]:







													if not isinstance(lowercase_							,	lowercase_    ) or (top_p < 0 or top_p > 1.0):
																			raise ValueError(f"""`top_p` has to be a float > 0 and < 1, but is {top_p}"""    )
													if not isinstance(lowercase_							,	lowercase_    ) or (min_tokens_to_keep < 1):
																			raise ValueError(f"""`min_tokens_to_keep` has to be a positive integer, but is {min_tokens_to_keep}"""    )

													SCREAMING_SNAKE_CASE__     :				Tuple   =					top_p
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					filter_value
													SCREAMING_SNAKE_CASE__     :				Tuple   =					min_tokens_to_keep






							def __call__(      self				:     Any							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:
													SCREAMING_SNAKE_CASE__,							SCREAMING_SNAKE_CASE__     :				List[Any]   =					lax.top_k(lowercase_							,	scores.shape[-1]    )

													SCREAMING_SNAKE_CASE__     :				Any   =					jnp.full_like(lowercase_							,	self.filter_value    )
													SCREAMING_SNAKE_CASE__     :				Tuple   =					jax.nn.softmax(lowercase_							,	axis=-1    ).cumsum(axis=-1    )
													SCREAMING_SNAKE_CASE__     :				Dict   =					cumulative_probs < self.top_p

													# include the token that is higher than top_p as well
													SCREAMING_SNAKE_CASE__     :				List[str]   =					jnp.roll(lowercase_							,	1    )
													score_mask |= score_mask.at[:, 0].set(lowercase_    )

													# min tokens to keep
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					score_mask.at[:, : self.min_tokens_to_keep].set(lowercase_    )

													SCREAMING_SNAKE_CASE__     :				str   =					jnp.where(lowercase_							,	lowercase_							,	lowercase_    )
													SCREAMING_SNAKE_CASE__     :				Any   =					jax.lax.sort_key_val(lowercase_							,	lowercase_    )[-1]

													return next_scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     List[str]							,	a				:     int							,	a				:     float = -float("Inf"    )							,	a				:     int = 1    )	->Any:







													if not isinstance(lowercase_							,	lowercase_    ) or top_k <= 0:
																			raise ValueError(f"""`top_k` has to be a strictly positive integer, but is {top_k}"""    )

													SCREAMING_SNAKE_CASE__     :				List[Any]   =					max(lowercase_							,	lowercase_    )
													SCREAMING_SNAKE_CASE__     :				Any   =					filter_value






							def __call__(      self				:     List[Any]							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:
													SCREAMING_SNAKE_CASE__,							SCREAMING_SNAKE_CASE__     :				List[str]   =					scores.shape
													SCREAMING_SNAKE_CASE__     :				Tuple   =					jnp.full(batch_size * vocab_size							,	self.filter_value    )

													SCREAMING_SNAKE_CASE__     :				str   =					min(self.top_k							,	scores.shape[-1]    )  # Safety check
													SCREAMING_SNAKE_CASE__,							SCREAMING_SNAKE_CASE__     :				str   =					lax.top_k(lowercase_							,	lowercase_    )
													SCREAMING_SNAKE_CASE__     :				Tuple   =					jnp.broadcast_to((jnp.arange(lowercase_    ) * vocab_size)[:, None]							,	(batch_size, topk)    ).flatten()
													SCREAMING_SNAKE_CASE__     :				List[str]   =					topk_scores.flatten()
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					topk_indices.flatten() + shift

													SCREAMING_SNAKE_CASE__     :				List[Any]   =					next_scores_flat.at[topk_indices_flat].set(lowercase_    )
													SCREAMING_SNAKE_CASE__     :				str   =					next_scores_flat.reshape(lowercase_							,	lowercase_    )
													return next_scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     int							,	a				:     int    )	->Optional[Any]:
													SCREAMING_SNAKE_CASE__     :				Dict   =					bos_token_id






							def __call__(      self				:     Union[str, Any]							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					jnp.full(scores.shape							,	-float("inf"    )    )

													SCREAMING_SNAKE_CASE__     :				Tuple   =					1 - jnp.bool_(cur_len - 1    )

													SCREAMING_SNAKE_CASE__     :				Dict   =					jnp.where(lowercase_							,	new_scores.at[:, self.bos_token_id].set(0    )							,	lowercase_    )

													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     Optional[Any]							,	a				:     int							,	a				:     int    )	->Tuple:
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					max_length
													SCREAMING_SNAKE_CASE__     :				Any   =					eos_token_id






							def __call__(      self				:     str							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					jnp.full(scores.shape							,	-float("inf"    )    )

													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					1 - jnp.bool_(cur_len - self.max_length + 1    )

													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					jnp.where(lowercase_							,	new_scores.at[:, self.eos_token_id].set(0    )							,	lowercase_    )

													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     int							,	a				:     int							,	a				:     int    )	->Dict:







													if not isinstance(lowercase_							,	lowercase_    ) or min_length < 0:
																			raise ValueError(f"""`min_length` has to be a positive integer, but is {min_length}"""    )

													if not isinstance(lowercase_							,	lowercase_    ) or eos_token_id < 0:
																			raise ValueError(f"""`eos_token_id` has to be a positive integer, but is {eos_token_id}"""    )

													SCREAMING_SNAKE_CASE__     :				Any   =					min_length
													SCREAMING_SNAKE_CASE__     :				List[str]   =					eos_token_id






							def __call__(      self				:     Tuple							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:
													SCREAMING_SNAKE_CASE__     :				int   =					1 - jnp.clip(cur_len - self.min_length							,	0							,	1    )

													SCREAMING_SNAKE_CASE__     :				Dict   =					jnp.where(lowercase_							,	scores.at[:, self.eos_token_id].set(-float("inf"    )    )							,	lowercase_    )

													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     Tuple							,	a				:     List[Any]							,	a				:     int    )	->Tuple:
													SCREAMING_SNAKE_CASE__     :				str   =					list(lowercase_    )
													SCREAMING_SNAKE_CASE__     :				Dict   =					begin_index






							def __call__(      self				:     Tuple							,	a				:     int							,	a				:     Dict							,	a				:     int    )	->Optional[Any]:
													SCREAMING_SNAKE_CASE__     :				Dict   =					1 - jnp.bool_(cur_len - self.begin_index    )

													SCREAMING_SNAKE_CASE__     :				Any   =					jnp.where(lowercase_							,	scores.at[:, self.begin_suppress_tokens].set(-float("inf"    )    )							,	lowercase_    )

													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     Union[str, Any]							,	a				:     list    )	->Optional[Any]:
													SCREAMING_SNAKE_CASE__     :				int   =					list(lowercase_    )






							def __call__(      self				:     Union[str, Any]							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:
													SCREAMING_SNAKE_CASE__     :				Any   =					scores.at[..., self.suppress_tokens].set(-float("inf"    )    )

													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     str							,	a				:     Union[str, Any]    )	->Any:
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					dict(lowercase_    )
													# Converts the dictionary of format {index: token} containing the tokens to be forced to an array, where the
													# index of the array corresponds to the index of the token to be forced, for XLA compatibility.
													# Indexes without forced tokens will have a negative value.
													SCREAMING_SNAKE_CASE__     :				List[str]   =					jnp.ones((max(force_token_map.keys()    ) + 1)							,	dtype=jnp.intaa    ) * -1
													for index, token in force_token_map.items():
																			if token is not None:
																									SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					force_token_array.at[index].set(lowercase_    )
													SCREAMING_SNAKE_CASE__     :				List[str]   =					jnp.intaa(lowercase_    )






							def __call__(      self				:     Tuple							,	a				:     jnp.ndarray							,	a				:     jnp.ndarray							,	a				:     int    )	->jnp.ndarray:







													def _force_token(a				:     Optional[Any]    ):
																			SCREAMING_SNAKE_CASE__     :				List[Any]   =					scores.shape[0]
																			SCREAMING_SNAKE_CASE__     :				List[str]   =					self.force_token_array[generation_idx]

																			SCREAMING_SNAKE_CASE__     :				List[Any]   =					jnp.ones_like(lowercase_							,	dtype=scores.dtype    ) * -float("inf"    )
																			SCREAMING_SNAKE_CASE__     :				List[Any]   =					jnp.zeros((batch_size, 1)							,	dtype=scores.dtype    )
																			SCREAMING_SNAKE_CASE__     :				List[str]   =					lax.dynamic_update_slice(lowercase_							,	lowercase_							,	(0, current_token)    )
																			return new_scores

													SCREAMING_SNAKE_CASE__     :				List[Any]   =					lax.cond(
													    cur_len >= self.force_token_array.shape[0]							,	lambda: scores							,	lambda: lax.cond(
													        self.force_token_array[cur_len] >= 0							,	lambda: _force_token(lowercase_    )							,	lambda: scores							,	)							,	)
													return scores







class    _a     (				lowercase__							):






							"""simple docstring"""

							def __init__(      self				:     List[str]							,	a				:     Optional[Any]							,	a				:     Optional[int]							,	a				:     List[Any]    )	->Optional[Any]:
													SCREAMING_SNAKE_CASE__     :				Tuple   =					generate_config.eos_token_id
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					generate_config.no_timestamps_token_id
													SCREAMING_SNAKE_CASE__     :				int   =					generate_config.no_timestamps_token_id + 1

													SCREAMING_SNAKE_CASE__     :				Tuple   =					decoder_input_length + 1

													if generate_config.is_multilingual:
																			# room for language token and task token
																			self.begin_index += 2
													if hasattr(lowercase_							,	"max_initial_timestamp_index"    ):
																			SCREAMING_SNAKE_CASE__     :				Any   =					generate_config.max_initial_timestamp_index
													else:
																			SCREAMING_SNAKE_CASE__     :				Tuple   =					model_config.vocab_size
													if self.max_initial_timestamp_index is None:
																			SCREAMING_SNAKE_CASE__     :				str   =					model_config.vocab_size






							def __call__(      self				:     int							,	a				:     List[str]							,	a				:     List[Any]							,	a				:     Optional[Any]    )	->List[str]:
													SCREAMING_SNAKE_CASE__     :				int   =					scores.at[:, self.no_timestamps_token_id].set(-float("inf"    )    )

													def handle_pairs(a				:     Optional[Any]							,	a				:     int    ):
																			SCREAMING_SNAKE_CASE__     :				Any   =					jnp.where((cur_len - self.begin_index) >= 1							,	lowercase_							,	lowercase_    )
																			SCREAMING_SNAKE_CASE__     :				int   =					jnp.where(
																			    input_ids_k[cur_len - 1] >= self.timestamp_begin							,	True and last_was_timestamp							,	lowercase_							,	)

																			SCREAMING_SNAKE_CASE__     :				List[Any]   =					jnp.where((cur_len - self.begin_index) < 2							,	lowercase_							,	lowercase_    )
																			SCREAMING_SNAKE_CASE__     :				str   =					jnp.where(
																			    input_ids_k[cur_len - 2] >= self.timestamp_begin							,	lowercase_							,	lowercase_							,	)

																			return jnp.where(
																			    lowercase_							,	jnp.where(
																			        penultimate_was_timestamp > 0							,	scores_k.at[self.timestamp_begin :].set(-float("inf"    )    )							,	scores_k.at[: self.eos_token_id].set(-float("inf"    )    )							,	)							,	lowercase_							,	)

													SCREAMING_SNAKE_CASE__     :				Any   =					jax.vmap(lowercase_    )(lowercase_							,	lowercase_    )

													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					jnp.where(cur_len == self.begin_index							,	lowercase_							,	lowercase_    )
													SCREAMING_SNAKE_CASE__     :				int   =					jnp.where(
													    self.max_initial_timestamp_index is not None							,	True and apply_max_initial_timestamp							,	lowercase_							,	)

													SCREAMING_SNAKE_CASE__     :				str   =					self.timestamp_begin + self.max_initial_timestamp_index

													SCREAMING_SNAKE_CASE__     :				Dict   =					jnp.where(
													    lowercase_							,	scores.at[:, last_allowed + 1 :].set(-float("inf"    )    )							,	lowercase_							,	)

													# if sum of probability over timestamps is above any other token, sample timestamp
													SCREAMING_SNAKE_CASE__     :				List[str]   =					jax.nn.log_softmax(lowercase_							,	axis=-1    )

													def handle_cumulative_probs(a				:     int							,	a				:     List[str]    ):
																			SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					jax.nn.logsumexp(logprobs_k[self.timestamp_begin :]							,	axis=-1    )
																			SCREAMING_SNAKE_CASE__     :				Dict   =					jnp.max(logprobs_k[: self.timestamp_begin]    )
																			return jnp.where(
																			    timestamp_logprob > max_text_token_logprob							,	scores_k.at[: self.timestamp_begin].set(-float("inf"    )    )							,	lowercase_							,	)

													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					jax.vmap(lowercase_    )(lowercase_							,	lowercase_    )

													return scores






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 (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, logging


__lowercase       :int       =  logging.get_logger(__name__)



class    _a     (				lowercase__							):






							"""simple docstring"""

							snake_case_							 =						["pixel_values"]

							def __init__(      self				:     int							,	a				:     bool = True							,	a				:     Optional[Dict[str, int]] = None							,	a				:     PILImageResampling = PILImageResampling.BILINEAR							,	a				:     bool = True							,	a				:     Dict[str, int] = None							,	a				:     bool = True							,	a				:     Union[int, float] = 1 / 2_55							,	a				:     bool = True							,	a				:     Optional[Union[float, List[float]]] = None							,	a				:     Optional[Union[float, List[float]]] = None							,	**a				:     List[str]							,	)	->None:
													super().__init__(**a    )
													SCREAMING_SNAKE_CASE__     :				List[str]   =					size if size is not None else {"shortest_edge": 2_56}
													SCREAMING_SNAKE_CASE__     :				Any   =					get_size_dict(a							,	default_to_square=a    )
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					crop_size if crop_size is not None else {"height": 2_24, "width": 2_24}
													SCREAMING_SNAKE_CASE__     :				Dict   =					get_size_dict(a    )
													SCREAMING_SNAKE_CASE__     :				List[str]   =					do_resize
													SCREAMING_SNAKE_CASE__     :				List[str]   =					size
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					resample
													SCREAMING_SNAKE_CASE__     :				int   =					do_center_crop
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					crop_size
													SCREAMING_SNAKE_CASE__     :				Any   =					do_rescale
													SCREAMING_SNAKE_CASE__     :				Any   =					rescale_factor
													SCREAMING_SNAKE_CASE__     :				int   =					do_normalize
													SCREAMING_SNAKE_CASE__     :				str   =					image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
													SCREAMING_SNAKE_CASE__     :				int   =					image_std if image_std is not None else IMAGENET_STANDARD_STD

							def      A_  (      self				:     Tuple							,	a				:     np.ndarray							,	a				:     Dict[str, int]							,	a				:     PILImageResampling = PILImageResampling.BICUBIC							,	a				:     Optional[Union[str, ChannelDimension]] = None							,	**a				:     Optional[int]							,	)	->np.ndarray:
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					get_size_dict(a							,	default_to_square=a    )
													if "shortest_edge" not in size:
																			raise ValueError(f"""The `size` parameter must contain the key `shortest_edge`. Got {size.keys()}"""    )
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					get_resize_output_image_size(a							,	size=size["shortest_edge"]							,	default_to_square=a    )
													return resize(a							,	size=a							,	resample=a							,	data_format=a							,	**a    )

							def      A_  (      self				:     List[Any]							,	a				:     np.ndarray							,	a				:     Dict[str, int]							,	a				:     Optional[Union[str, ChannelDimension]] = None							,	**a				:     List[Any]							,	)	->np.ndarray:
													SCREAMING_SNAKE_CASE__     :				Tuple   =					get_size_dict(a    )
													return center_crop(a							,	size=(size["height"], size["width"])							,	data_format=a							,	**a    )

							def      A_  (      self				:     Optional[int]							,	a				:     np.ndarray							,	a				:     float							,	a				:     Optional[Union[str, ChannelDimension]] = None							,	**a				:     Dict    )	->np.ndarray:
													return rescale(a							,	scale=a							,	data_format=a							,	**a    )

							def      A_  (      self				:     Union[str, Any]							,	a				:     np.ndarray							,	a				:     Union[float, List[float]]							,	a				:     Union[float, List[float]]							,	a				:     Optional[Union[str, ChannelDimension]] = None							,	**a				:     Union[str, Any]							,	)	->np.ndarray:
													return normalize(a							,	mean=a							,	std=a							,	data_format=a							,	**a    )






							def      A_  (      self				:     Tuple							,	a				:     ImageInput							,	a				:     Optional[bool] = None							,	a				:     Dict[str, int] = None							,	a				:     PILImageResampling = None							,	a				:     bool = None							,	a				:     Dict[str, int] = None							,	a				:     Optional[bool] = None							,	a				:     Optional[float] = None							,	a				:     Optional[bool] = None							,	a				:     Optional[Union[float, List[float]]] = None							,	a				:     Optional[Union[float, List[float]]] = None							,	a				:     Optional[Union[str, TensorType]] = None							,	a				:     Union[str, ChannelDimension] = ChannelDimension.FIRST							,	**a				:     Any							,	)	->Optional[int]:
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					do_resize if do_resize is not None else self.do_resize
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					size if size is not None else self.size
													SCREAMING_SNAKE_CASE__     :				Dict   =					get_size_dict(a							,	default_to_square=a    )
													SCREAMING_SNAKE_CASE__     :				str   =					resample if resample is not None else self.resample
													SCREAMING_SNAKE_CASE__     :				List[str]   =					do_center_crop if do_center_crop is not None else self.do_center_crop
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					crop_size if crop_size is not None else self.crop_size
													SCREAMING_SNAKE_CASE__     :				Dict   =					get_size_dict(a    )
													SCREAMING_SNAKE_CASE__     :				List[str]   =					do_rescale if do_rescale is not None else self.do_rescale
													SCREAMING_SNAKE_CASE__     :				int   =					rescale_factor if rescale_factor is not None else self.rescale_factor
													SCREAMING_SNAKE_CASE__     :				Dict   =					do_normalize if do_normalize is not None else self.do_normalize
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					image_mean if image_mean is not None else self.image_mean
													SCREAMING_SNAKE_CASE__     :				Tuple   =					image_std if image_std is not None else self.image_std

													SCREAMING_SNAKE_CASE__     :				Union[str, 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:
																			raise ValueError("Size must be specified if do_resize is True."    )

													if do_center_crop and crop_size is None:
																			raise ValueError("Crop size must be specified if do_center_crop is True."    )

													if do_rescale and rescale_factor is None:
																			raise ValueError("Rescale factor must be specified if do_rescale is True."    )

													if do_normalize and (image_mean is None or image_std is None):
																			raise ValueError("Image mean and std must be specified if do_normalize is True."    )

													# All transformations expect numpy arrays.
													SCREAMING_SNAKE_CASE__     :				List[str]   =					[to_numpy_array(a    ) for image in images]

													if do_resize:
																			SCREAMING_SNAKE_CASE__     :				Tuple   =					[self.resize(image=a							,	size=a							,	resample=a    ) for image in images]

													if do_center_crop:
																			SCREAMING_SNAKE_CASE__     :				List[Any]   =					[self.center_crop(image=a							,	size=a    ) for image in images]

													if do_rescale:
																			SCREAMING_SNAKE_CASE__     :				List[str]   =					[self.rescale(image=a							,	scale=a    ) for image in images]

													if do_normalize:
																			SCREAMING_SNAKE_CASE__     :				Dict   =					[self.normalize(image=a							,	mean=a							,	std=a    ) for image in images]

													SCREAMING_SNAKE_CASE__     :				Dict   =					[to_channel_dimension_format(a							,	a    ) for image in images]

													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					{"pixel_values": images}
													return BatchFeature(data=a							,	tensor_type=a    )