





from __future__ import annotations

import unittest

from transformers import FunnelConfig, is_tf_available
from transformers.testing_utils import require_tf

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
				import tensorflow as tf

				from transformers import (
				    TFFunnelBaseModel,
				    TFFunnelForMaskedLM,
				    TFFunnelForMultipleChoice,
				    TFFunnelForPreTraining,
				    TFFunnelForQuestionAnswering,
				    TFFunnelForSequenceClassification,
				    TFFunnelForTokenClassification,
				    TFFunnelModel,
				)



class    _a     :






							"""simple docstring"""

							def __init__(      self				:     Union[str, Any]							,	a				:     Optional[int]							,	a				:     str=13							,	a				:     Tuple=7							,	a				:     str=True							,	a				:     int=True							,	a				:     Any=True							,	a				:     List[str]=True							,	a				:     Dict=99							,	a				:     Dict=[1, 1, 2]							,	a				:     Tuple=1							,	a				:     Tuple=32							,	a				:     str=4							,	a				:     Optional[int]=8							,	a				:     Optional[Any]=37							,	a				:     str="gelu_new"							,	a				:     Dict=0.1							,	a				:     str=0.1							,	a				:     Optional[int]=0.0							,	a				:     Any=5_12							,	a				:     Optional[Any]=3							,	a				:     List[Any]=0.02							,	a				:     Optional[int]=3							,	a				:     str=4							,	a				:     Any=None							,	a				:     Tuple=False							,	)	->Tuple:
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					parent
													SCREAMING_SNAKE_CASE__     :				Tuple   =					batch_size
													SCREAMING_SNAKE_CASE__     :				int   =					seq_length
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					is_training
													SCREAMING_SNAKE_CASE__     :				List[str]   =					use_input_mask
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					use_token_type_ids
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					use_labels
													SCREAMING_SNAKE_CASE__     :				Dict   =					vocab_size
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					block_sizes
													SCREAMING_SNAKE_CASE__     :				int   =					num_decoder_layers
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					d_model
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					n_head
													SCREAMING_SNAKE_CASE__     :				Any   =					d_head
													SCREAMING_SNAKE_CASE__     :				int   =					d_inner
													SCREAMING_SNAKE_CASE__     :				List[str]   =					hidden_act
													SCREAMING_SNAKE_CASE__     :				int   =					hidden_dropout
													SCREAMING_SNAKE_CASE__     :				Dict   =					attention_dropout
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					activation_dropout
													SCREAMING_SNAKE_CASE__     :				int   =					max_position_embeddings
													SCREAMING_SNAKE_CASE__     :				List[str]   =					type_vocab_size
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					2
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					num_labels
													SCREAMING_SNAKE_CASE__     :				Any   =					num_choices
													SCREAMING_SNAKE_CASE__     :				Dict   =					scope
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					initializer_std

													# Used in the tests to check the size of the first attention layer
													SCREAMING_SNAKE_CASE__     :				Any   =					n_head
													# Used in the tests to check the size of the first hidden state
													SCREAMING_SNAKE_CASE__     :				Tuple   =					self.d_model
													# Used in the tests to check the number of output hidden states/attentions
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					sum(self.block_sizes    ) + (0 if base else self.num_decoder_layers)
													# FunnelModel adds two hidden layers: input embeddings and the sum of the upsampled encoder hidden state with
													# the last hidden state of the first block (which is the first hidden state of the decoder).
													if not base:
																			SCREAMING_SNAKE_CASE__     :				Optional[int]   =					self.num_hidden_layers + 2

							def      A_  (      self				:     Any    )	->Tuple:
													SCREAMING_SNAKE_CASE__     :				Tuple   =					ids_tensor([self.batch_size, self.seq_length]							,	self.vocab_size    )

													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					None
													if self.use_input_mask:
																			SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					random_attention_mask([self.batch_size, self.seq_length]    )

													SCREAMING_SNAKE_CASE__     :				Tuple   =					None
													if self.use_token_type_ids:
																			SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					ids_tensor([self.batch_size, self.seq_length]							,	self.type_vocab_size    )

													SCREAMING_SNAKE_CASE__     :				Any   =					None
													SCREAMING_SNAKE_CASE__     :				Any   =					None
													SCREAMING_SNAKE_CASE__     :				int   =					None
													if self.use_labels:
																			SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					ids_tensor([self.batch_size]							,	self.type_sequence_label_size    )
																			SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					ids_tensor([self.batch_size, self.seq_length]							,	self.num_labels    )
																			SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					ids_tensor([self.batch_size]							,	self.num_choices    )

													SCREAMING_SNAKE_CASE__     :				int   =					FunnelConfig(
													    vocab_size=self.vocab_size							,	block_sizes=self.block_sizes							,	num_decoder_layers=self.num_decoder_layers							,	d_model=self.d_model							,	n_head=self.n_head							,	d_head=self.d_head							,	d_inner=self.d_inner							,	hidden_act=self.hidden_act							,	hidden_dropout=self.hidden_dropout							,	attention_dropout=self.attention_dropout							,	activation_dropout=self.activation_dropout							,	max_position_embeddings=self.max_position_embeddings							,	type_vocab_size=self.type_vocab_size							,	initializer_std=self.initializer_std							,	)

													return (
													    config,
													    input_ids,
													    token_type_ids,
													    input_mask,
													    sequence_labels,
													    token_labels,
													    choice_labels,
													)

							def      A_  (      self				:     Any							,	a				:     Union[str, Any]							,	a				:     Optional[int]							,	a				:     Tuple							,	a				:     Any							,	a				:     Tuple							,	a				:     Tuple							,	a				:     str							,	)	->List[Any]:
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					TFFunnelModel(config=a    )
													SCREAMING_SNAKE_CASE__     :				Dict   =					{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					model(a    )

													SCREAMING_SNAKE_CASE__     :				int   =					[input_ids, input_mask]
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					model(a    )

													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					model(a    )
													self.parent.assertEqual(result.last_hidden_state.shape							,	(self.batch_size, self.seq_length, self.d_model)    )

													SCREAMING_SNAKE_CASE__     :				str   =					False
													SCREAMING_SNAKE_CASE__     :				Tuple   =					TFFunnelModel(config=a    )
													SCREAMING_SNAKE_CASE__     :				Dict   =					model(a    )
													self.parent.assertEqual(result.last_hidden_state.shape							,	(self.batch_size, self.seq_length, self.d_model)    )

													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					False
													SCREAMING_SNAKE_CASE__     :				Dict   =					TFFunnelModel(config=a    )
													SCREAMING_SNAKE_CASE__     :				int   =					model(a    )
													self.parent.assertEqual(result.last_hidden_state.shape							,	(self.batch_size, self.seq_length, self.d_model)    )

							def      A_  (      self				:     Any							,	a				:     str							,	a				:     Any							,	a				:     Dict							,	a				:     str							,	a				:     Union[str, Any]							,	a				:     List[str]							,	a				:     List[Any]							,	)	->str:
													SCREAMING_SNAKE_CASE__     :				str   =					TFFunnelBaseModel(config=a    )
													SCREAMING_SNAKE_CASE__     :				Tuple   =					{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					model(a    )

													SCREAMING_SNAKE_CASE__     :				Tuple   =					[input_ids, input_mask]
													SCREAMING_SNAKE_CASE__     :				Tuple   =					model(a    )

													SCREAMING_SNAKE_CASE__     :				List[Any]   =					model(a    )
													self.parent.assertEqual(result.last_hidden_state.shape							,	(self.batch_size, 2, self.d_model)    )

													SCREAMING_SNAKE_CASE__     :				int   =					False
													SCREAMING_SNAKE_CASE__     :				List[str]   =					TFFunnelBaseModel(config=a    )
													SCREAMING_SNAKE_CASE__     :				Dict   =					model(a    )
													self.parent.assertEqual(result.last_hidden_state.shape							,	(self.batch_size, 3, self.d_model)    )

													SCREAMING_SNAKE_CASE__     :				str   =					False
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					TFFunnelBaseModel(config=a    )
													SCREAMING_SNAKE_CASE__     :				List[str]   =					model(a    )
													self.parent.assertEqual(result.last_hidden_state.shape							,	(self.batch_size, 2, self.d_model)    )

							def      A_  (      self				:     Any							,	a				:     str							,	a				:     Union[str, Any]							,	a				:     Union[str, Any]							,	a				:     int							,	a				:     Any							,	a				:     Optional[Any]							,	a				:     Tuple							,	)	->Optional[Any]:
													SCREAMING_SNAKE_CASE__     :				int   =					TFFunnelForPreTraining(config=a    )
													SCREAMING_SNAKE_CASE__     :				Tuple   =					{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
													SCREAMING_SNAKE_CASE__     :				Tuple   =					model(a    )
													self.parent.assertEqual(result.logits.shape							,	(self.batch_size, self.seq_length)    )

							def      A_  (      self				:     int							,	a				:     int							,	a				:     Optional[int]							,	a				:     Union[str, Any]							,	a				:     int							,	a				:     Optional[int]							,	a				:     Optional[Any]							,	a				:     Tuple							,	)	->List[str]:
													SCREAMING_SNAKE_CASE__     :				str   =					TFFunnelForMaskedLM(config=a    )
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
													SCREAMING_SNAKE_CASE__     :				List[str]   =					model(a    )
													self.parent.assertEqual(result.logits.shape							,	(self.batch_size, self.seq_length, self.vocab_size)    )

							def      A_  (      self				:     Union[str, Any]							,	a				:     Dict							,	a				:     List[str]							,	a				:     int							,	a				:     Optional[Any]							,	a				:     Tuple							,	a				:     Any							,	a				:     Dict							,	)	->int:
													SCREAMING_SNAKE_CASE__     :				Union[str, Any]   =					self.num_labels
													SCREAMING_SNAKE_CASE__     :				Any   =					TFFunnelForSequenceClassification(config=a    )
													SCREAMING_SNAKE_CASE__     :				str   =					{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
													SCREAMING_SNAKE_CASE__     :				int   =					model(a    )
													self.parent.assertEqual(result.logits.shape							,	(self.batch_size, self.num_labels)    )

							def      A_  (      self				:     Optional[Any]							,	a				:     Optional[Any]							,	a				:     str							,	a				:     int							,	a				:     int							,	a				:     Any							,	a				:     Optional[Any]							,	a				:     Union[str, Any]							,	)	->Optional[int]:
													SCREAMING_SNAKE_CASE__     :				Any   =					self.num_choices
													SCREAMING_SNAKE_CASE__     :				int   =					TFFunnelForMultipleChoice(config=a    )
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					tf.tile(tf.expand_dims(a							,	1    )							,	(1, self.num_choices, 1)    )
													SCREAMING_SNAKE_CASE__     :				List[str]   =					tf.tile(tf.expand_dims(a							,	1    )							,	(1, self.num_choices, 1)    )
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					tf.tile(tf.expand_dims(a							,	1    )							,	(1, self.num_choices, 1)    )
													SCREAMING_SNAKE_CASE__     :				str   =					{
													    "input_ids": multiple_choice_inputs_ids,
													    "attention_mask": multiple_choice_input_mask,
													    "token_type_ids": multiple_choice_token_type_ids,
													}
													SCREAMING_SNAKE_CASE__     :				Any   =					model(a    )
													self.parent.assertEqual(result.logits.shape							,	(self.batch_size, self.num_choices)    )

							def      A_  (      self				:     Optional[Any]							,	a				:     Any							,	a				:     Dict							,	a				:     Union[str, Any]							,	a				:     List[str]							,	a				:     Tuple							,	a				:     Optional[int]							,	a				:     Dict							,	)	->Union[str, Any]:
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					self.num_labels
													SCREAMING_SNAKE_CASE__     :				Tuple   =					TFFunnelForTokenClassification(config=a    )
													SCREAMING_SNAKE_CASE__     :				int   =					{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					model(a    )
													self.parent.assertEqual(result.logits.shape							,	(self.batch_size, self.seq_length, self.num_labels)    )

							def      A_  (      self				:     Union[str, Any]							,	a				:     str							,	a				:     Optional[Any]							,	a				:     Any							,	a				:     Union[str, Any]							,	a				:     int							,	a				:     str							,	a				:     Tuple							,	)	->List[Any]:
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					TFFunnelForQuestionAnswering(config=a    )
													SCREAMING_SNAKE_CASE__     :				int   =					{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
													SCREAMING_SNAKE_CASE__     :				int   =					model(a    )
													self.parent.assertEqual(result.start_logits.shape							,	(self.batch_size, self.seq_length)    )
													self.parent.assertEqual(result.end_logits.shape							,	(self.batch_size, self.seq_length)    )






							def      A_  (      self				:     Optional[int]    )	->int:
													SCREAMING_SNAKE_CASE__     :				Dict   =					self.prepare_config_and_inputs()
													(
													    (
													    SCREAMING_SNAKE_CASE__
													),							(
													    SCREAMING_SNAKE_CASE__
													),							(
													    SCREAMING_SNAKE_CASE__
													),							(
													    SCREAMING_SNAKE_CASE__
													),							(
													    SCREAMING_SNAKE_CASE__
													),							(
													    SCREAMING_SNAKE_CASE__
													),							(
													    SCREAMING_SNAKE_CASE__
													),							
													)     :				Tuple   =					config_and_inputs
													SCREAMING_SNAKE_CASE__     :				str   =					{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
													return config, inputs_dict







@require_tf
class    _a     (				lowercase__					,							lowercase__					,							unittest.TestCase							):






							"""simple docstring"""

							snake_case_							 =						(
							    (
							        TFFunnelModel,
							        TFFunnelForMaskedLM,
							        TFFunnelForPreTraining,
							        TFFunnelForQuestionAnswering,
							        TFFunnelForTokenClassification,
							    )
							    if is_tf_available()
							    else ()
							)
							snake_case_							 =						(
							    {
							        "feature-extraction": (TFFunnelBaseModel, TFFunnelModel),
							        "fill-mask": TFFunnelForMaskedLM,
							        "question-answering": TFFunnelForQuestionAnswering,
							        "text-classification": TFFunnelForSequenceClassification,
							        "token-classification": TFFunnelForTokenClassification,
							        "zero-shot": TFFunnelForSequenceClassification,
							    }
							    if is_tf_available()
							    else {}
							)
							snake_case_							 =						False
							snake_case_							 =						False

							def      A_  (      self				:     Any    )	->List[Any]:
													SCREAMING_SNAKE_CASE__     :				str   =					TFFunnelModelTester(self    )
													SCREAMING_SNAKE_CASE__     :				Any   =					ConfigTester(self							,	config_class=a    )

							def      A_  (      self				:     Any    )	->str:
													self.config_tester.run_common_tests()

							def      A_  (      self				:     int    )	->int:
													SCREAMING_SNAKE_CASE__     :				Any   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_model(*a    )

							def      A_  (      self				:     Union[str, Any]    )	->Any:
													SCREAMING_SNAKE_CASE__     :				str   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_pretraining(*a    )

							def      A_  (      self				:     Optional[int]    )	->List[Any]:
													SCREAMING_SNAKE_CASE__     :				Tuple   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_masked_lm(*a    )

							def      A_  (      self				:     Optional[int]    )	->Any:
													SCREAMING_SNAKE_CASE__     :				str   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_token_classification(*a    )






							def      A_  (      self				:     Tuple    )	->Any:
													SCREAMING_SNAKE_CASE__     :				Any   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_question_answering(*a    )







@require_tf
class    _a     (				lowercase__					,							unittest.TestCase							):






							"""simple docstring"""

							snake_case_							 =						(
							    (TFFunnelBaseModel, TFFunnelForMultipleChoice, TFFunnelForSequenceClassification) if is_tf_available() else ()
							)
							snake_case_							 =						False
							snake_case_							 =						False

							def      A_  (      self				:     List[str]    )	->Any:
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					TFFunnelModelTester(self							,	base=a    )
													SCREAMING_SNAKE_CASE__     :				List[str]   =					ConfigTester(self							,	config_class=a    )

							def      A_  (      self				:     Optional[Any]    )	->Union[str, Any]:
													self.config_tester.run_common_tests()

							def      A_  (      self				:     Any    )	->Optional[Any]:
													SCREAMING_SNAKE_CASE__     :				Dict   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_base_model(*a    )

							def      A_  (      self				:     Dict    )	->int:
													SCREAMING_SNAKE_CASE__     :				Tuple   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_sequence_classification(*a    )






							def      A_  (      self				:     Union[str, Any]    )	->str:
													SCREAMING_SNAKE_CASE__     :				Tuple   =					self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_multiple_choice(*a    )






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    )