



'''simple docstring'''







from __future__ import annotations

import unittest

from transformers import CTRLConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

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.models.ctrl.modeling_tf_ctrl import (
		    TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFCTRLForSequenceClassification,
		    TFCTRLLMHeadModel,
		    TFCTRLModel,
		)

class      lowerCamelCase__     (     _A				):






	'''simple docstring'''

	def __init__(  self		:  Optional[Any]   ,		__A		:  Optional[Any]   ,		)     ->			Any:




								'''simple docstring'''





								lowerCAmelCase__  =   parent
								lowerCAmelCase__  =   13
								lowerCAmelCase__  =   7
								lowerCAmelCase__  =   True
								lowerCAmelCase__  =   True
								lowerCAmelCase__  =   True
								lowerCAmelCase__  =   True
								lowerCAmelCase__  =   True
								lowerCAmelCase__  =   99
								lowerCAmelCase__  =   32
								lowerCAmelCase__  =   2
								lowerCAmelCase__  =   4
								lowerCAmelCase__  =   37
								lowerCAmelCase__  =   "gelu"
								lowerCAmelCase__  =   0.1
								lowerCAmelCase__  =   0.1
								lowerCAmelCase__  =   512
								lowerCAmelCase__  =   16
								lowerCAmelCase__  =   2
								lowerCAmelCase__  =   0.0_2
								lowerCAmelCase__  =   3
								lowerCAmelCase__  =   4
								lowerCAmelCase__  =   None
								lowerCAmelCase__  =   self.vocab_size - 1




	def      lowercase__							(  self		:  List[str]					)     ->			Tuple:




								'''simple docstring'''





								lowerCAmelCase__  =   ids_tensor([self.batch_size, self.seq_length]   ,		self.vocab_size					)

								lowerCAmelCase__  =   None
								if self.use_input_mask:
															lowerCAmelCase__  =   random_attention_mask([self.batch_size, self.seq_length]					)

								lowerCAmelCase__  =   None
								if self.use_token_type_ids:
															lowerCAmelCase__  =   ids_tensor([self.batch_size, self.seq_length]   ,		self.type_vocab_size					)

								lowerCAmelCase__  =   None
								if self.use_mc_token_ids:
															lowerCAmelCase__  =   ids_tensor([self.batch_size, self.num_choices]   ,		self.seq_length					)

								lowerCAmelCase__  =   None
								lowerCAmelCase__  =   None
								lowerCAmelCase__  =   None
								if self.use_labels:
															lowerCAmelCase__  =   ids_tensor([self.batch_size]   ,		self.type_sequence_label_size					)
															lowerCAmelCase__  =   ids_tensor([self.batch_size, self.seq_length]   ,		self.num_labels					)
															lowerCAmelCase__  =   ids_tensor([self.batch_size]   ,		self.num_choices					)

								lowerCAmelCase__  =   CTRLConfig(
								    vocab_size=self.vocab_size   ,		n_embd=self.hidden_size   ,		n_layer=self.num_hidden_layers   ,		n_head=self.num_attention_heads   ,		n_positions=self.max_position_embeddings   ,		pad_token_id=self.pad_token_id   ,		)

								lowerCAmelCase__  =   ids_tensor([self.num_hidden_layers, self.num_attention_heads]   ,		2					)

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




	def      lowercase__							(  self		:  List[Any]   ,		__A		:  str   ,		__A		:  Tuple   ,		__A		:  List[str]   ,		__A		:  List[Any]   ,		__A		:  str   ,		*__A		:  Dict					)     ->			int:




								'''simple docstring'''





								lowerCAmelCase__  =   TFCTRLModel(config=_lowerCAmelCase					)
								lowerCAmelCase__  =   {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								lowerCAmelCase__  =   model(_lowerCAmelCase					)

								lowerCAmelCase__  =   [input_ids, None, input_mask]  # None is the input for 'past'
								lowerCAmelCase__  =   model(_lowerCAmelCase					)

								lowerCAmelCase__  =   model(_lowerCAmelCase					)

								self.parent.assertEqual(result.last_hidden_state.shape   ,		(self.batch_size, self.seq_length, self.hidden_size)					)




	def      lowercase__							(  self		:  Tuple   ,		__A		:  Optional[int]   ,		__A		:  str   ,		__A		:  List[Any]   ,		__A		:  str   ,		__A		:  Optional[Any]   ,		*__A		:  List[Any]					)     ->			int:




								'''simple docstring'''





								lowerCAmelCase__  =   TFCTRLLMHeadModel(config=_lowerCAmelCase					)
								lowerCAmelCase__  =   {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
								lowerCAmelCase__  =   model(_lowerCAmelCase					)
								self.parent.assertEqual(result.logits.shape   ,		(self.batch_size, self.seq_length, self.vocab_size)					)




	def      lowercase__							(  self		:  Dict   ,		__A		:  str   ,		__A		:  Any   ,		__A		:  str   ,		__A		:  Any   ,		__A		:  Union[str, Any]   ,		*__A		:  Any					)     ->			List[str]:




								'''simple docstring'''





								lowerCAmelCase__  =   self.num_labels
								lowerCAmelCase__  =   ids_tensor([self.batch_size]   ,		self.type_sequence_label_size					)
								lowerCAmelCase__  =   {
								    "input_ids": input_ids,
								    "token_type_ids": token_type_ids,
								    "labels": sequence_labels,
								}
								lowerCAmelCase__  =   TFCTRLForSequenceClassification(_lowerCAmelCase					)
								lowerCAmelCase__  =   model(_lowerCAmelCase					)
								self.parent.assertEqual(result.logits.shape   ,		(self.batch_size, self.num_labels)					)




	def      lowercase__							(  self		:  Optional[int]					)     ->			Tuple:




								'''simple docstring'''





								lowerCAmelCase__  =   self.prepare_config_and_inputs()

								(
								    lowerCAmelCase__     
								)  =   config_and_inputs

								lowerCAmelCase__  =   {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
								return config, inputs_dict





@require_tf
class      lowerCamelCase__     (     _A,     _A,     unittest.TestCase				):






	'''simple docstring'''

	A__		=	(TFCTRLModel, TFCTRLLMHeadModel, TFCTRLForSequenceClassification) if is_tf_available() else ()
	A__		=	(TFCTRLLMHeadModel,) if is_tf_available() else ()
	A__		=	(
	    {
	        '''feature-extraction''': TFCTRLModel,
	        '''text-classification''': TFCTRLForSequenceClassification,
	        '''text-generation''': TFCTRLLMHeadModel,
	        '''zero-shot''': TFCTRLForSequenceClassification,
	    }
	    if is_tf_available()
	    else {}
	)
	A__		=	False
	A__		=	False




	def      lowercase__							(  self		:  Dict   ,		__A		:  str   ,		__A		:  List[Any]   ,		__A		:  str   ,		__A		:  Tuple   ,		__A		:  Any					)     ->			Optional[Any]:




								'''simple docstring'''





								if pipeline_test_casse_name == "ZeroShotClassificationPipelineTests":
															# Get `tokenizer does not have a padding token` error for both fast/slow tokenizers.
															# `CTRLConfig` was never used in pipeline tests, either because of a missing checkpoint or because a tiny
															# config could not be created.
															return True

								return False




	def      lowercase__							(  self		:  Optional[int]					)     ->			Tuple:




								'''simple docstring'''





								lowerCAmelCase__  =   TFCTRLModelTester(self					)
								lowerCAmelCase__  =   ConfigTester(self   ,		config_class=_lowerCAmelCase   ,		n_embd=37					)




	def      lowercase__							(  self		:  Optional[Any]					)     ->			Tuple:




								'''simple docstring'''





								self.config_tester.run_common_tests()




	def      lowercase__							(  self		:  Tuple					)     ->			Tuple:




								'''simple docstring'''





								lowerCAmelCase__  =   self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_ctrl_model(*_lowerCAmelCase					)




	def      lowercase__							(  self		:  Union[str, Any]					)     ->			Tuple:




								'''simple docstring'''





								lowerCAmelCase__  =   self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_ctrl_lm_head(*_lowerCAmelCase					)




	def      lowercase__							(  self		:  Any					)     ->			Tuple:




								'''simple docstring'''





								lowerCAmelCase__  =   self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_ctrl_for_sequence_classification(*_lowerCAmelCase					)




	def      lowercase__							(  self		:  Optional[Any]					)     ->			int:




								'''simple docstring'''





								lowerCAmelCase__  =   self.model_tester.prepare_config_and_inputs_for_common()
								lowerCAmelCase__  =   [TFCTRLLMHeadModel]
								lowerCAmelCase__  =   [TFCTRLForSequenceClassification]

								for model_class in self.all_model_classes:
															lowerCAmelCase__  =   model_class(_lowerCAmelCase					)
															model.build()  # may be needed for the get_bias() call below
															assert isinstance(model.get_input_embeddings()   ,		tf.keras.layers.Layer					)

															if model_class in list_lm_models:
																						lowerCAmelCase__  =   model.get_output_embeddings()
																						assert isinstance(_lowerCAmelCase   ,		tf.keras.layers.Layer					)
																						lowerCAmelCase__  =   model.get_bias()
																						assert isinstance(_lowerCAmelCase   ,		_lowerCAmelCase					)
																						for k, v in name.items():
																													assert isinstance(_lowerCAmelCase   ,		tf.Variable					)
															elif model_class in list_other_models_with_output_ebd:
																						lowerCAmelCase__  =   model.get_output_embeddings()
																						assert isinstance(_lowerCAmelCase   ,		tf.keras.layers.Layer					)
																						lowerCAmelCase__  =   model.get_bias()
																						assert name is None
															else:
																						lowerCAmelCase__  =   model.get_output_embeddings()
																						assert x is None
																						lowerCAmelCase__  =   model.get_bias()
																						assert name is None




	@slow
	def      lowercase__							(  self		:  Optional[int]					)     ->			Tuple:




								'''simple docstring'''





								for model_name in TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
															lowerCAmelCase__  =   TFCTRLModel.from_pretrained(_lowerCAmelCase					)
															self.assertIsNotNone(_lowerCAmelCase					)





@require_tf
class      lowerCamelCase__     (     unittest.TestCase				):






	'''simple docstring'''

	@slow
	def      lowercase__							(  self		:  int					)     ->			Any:




								'''simple docstring'''





								lowerCAmelCase__  =   TFCTRLLMHeadModel.from_pretrained("""ctrl"""					)
								lowerCAmelCase__  =   tf.convert_to_tensor([[1_1859, 0, 1611, 8]]   ,		dtype=tf.intaa					)  # Legal the president is
								lowerCAmelCase__  =   [
								    1_1859,
								    0,
								    1611,
								    8,
								    5,
								    150,
								    2_6449,
								    2,
								    19,
								    348,
								    469,
								    3,
								    2595,
								    48,
								    2_0740,
								    24_6533,
								    24_6533,
								    19,
								    30,
								    5,
								]  # Legal the president is a good guy and I don't want to lose my job. \n \n I have a

								lowerCAmelCase__  =   model.generate(_lowerCAmelCase   ,		do_sample=_lowerCAmelCase					)
								self.assertListEqual(output_ids[0].numpy().tolist()   ,		_lowerCAmelCase					)











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


_UpperCAmelCase						:    Optional[Any]      =  logging.get_logger(__name__)


if is_vision_available():
     import PIL




class  __lowerCAmelCase							(				lowerCAmelCase):
       _a			       =    ['''pixel_values''']






       def __init__( self:       Optional[int]							,       _lowerCAmelCase:       bool = True							,       _lowerCAmelCase:       Dict[str, int] = None							,       _lowerCAmelCase:       PILImageResampling = PILImageResampling.BILINEAR							,       _lowerCAmelCase:       bool = True							,       _lowerCAmelCase:       bool = False							,       _lowerCAmelCase:       bool = True							,       _lowerCAmelCase:       bool = True							,       _lowerCAmelCase:       Union[int, float] = 1 / 2_55							,       _lowerCAmelCase:       bool = True							,       _lowerCAmelCase:       Optional[Union[float, List[float]]] = None							,       _lowerCAmelCase:       Optional[Union[float, List[float]]] = None							,       **_lowerCAmelCase:       Dict							,       ):
         super().__init__(**_lowerCAmelCase					)

         lowercase     :Tuple   						=    size if size is not None else {"height": 25_60, "width": 19_20}
         if isinstance(_lowerCAmelCase							,       (tuple, list)					):
           # The previous feature extractor size parameter was in (width, height) format
           lowercase     :Union[str, Any]   						=    size[::-1]
         lowercase     :int   						=    get_size_dict(_lowerCAmelCase					)

         lowercase     :Optional[Any]   						=    do_resize
         lowercase     :int   						=    size
         lowercase     :List[str]   						=    resample
         lowercase     :Any   						=    do_thumbnail
         lowercase     :Optional[int]   						=    do_align_long_axis
         lowercase     :Tuple   						=    do_pad
         lowercase     :Union[str, Any]   						=    do_rescale
         lowercase     :Union[str, Any]   						=    rescale_factor
         lowercase     :Optional[int]   						=    do_normalize
         lowercase     :Dict   						=    image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
         lowercase     :Union[str, Any]   						=    image_std if image_std is not None else IMAGENET_STANDARD_STD






       def        SCREAMING_SNAKE_CASE     ( self:       int							,       _lowerCAmelCase:       np.ndarray							,       _lowerCAmelCase:       Dict[str, int]							,       _lowerCAmelCase:       Optional[Union[str, ChannelDimension]] = None					):
         lowercase						,     lowercase     :int   						=    get_image_size(_lowerCAmelCase					)
         lowercase						,     lowercase     :str   						=    size["height"], size["width"]

         if (output_width < output_height and input_width > input_height) or (
             output_width > output_height and input_width < input_height
         ):
           lowercase     :Any   						=    np.rotaa(_lowerCAmelCase							,       3					)

         if data_format is not None:
           lowercase     :Optional[int]   						=    to_channel_dimension_format(_lowerCAmelCase							,       _lowerCAmelCase					)

         return image






       def        SCREAMING_SNAKE_CASE     ( self:       Optional[int]							,       _lowerCAmelCase:       np.ndarray							,       _lowerCAmelCase:       Dict[str, int]							,       _lowerCAmelCase:       bool = False							,       _lowerCAmelCase:       Optional[Union[str, ChannelDimension]] = None							,       ):
         lowercase						,     lowercase     :Tuple   						=    size["height"], size["width"]
         lowercase						,     lowercase     :Optional[int]   						=    get_image_size(_lowerCAmelCase					)

         lowercase     :List[Any]   						=    output_width - input_width
         lowercase     :Dict   						=    output_height - input_height

         if random_padding:
           lowercase     :List[str]   						=    np.random.randint(low=0							,       high=delta_height + 1					)
           lowercase     :List[Any]   						=    np.random.randint(low=0							,       high=delta_width + 1					)
         else:
           lowercase     :Dict   						=    delta_height // 2
           lowercase     :int   						=    delta_width // 2

         lowercase     :Optional[int]   						=    delta_height - pad_top
         lowercase     :Dict   						=    delta_width - pad_left

         lowercase     :Optional[Any]   						=    ((pad_top, pad_bottom), (pad_left, pad_right))
         return pad(_lowerCAmelCase							,       _lowerCAmelCase							,       data_format=_lowerCAmelCase					)






       def        SCREAMING_SNAKE_CASE     ( self:       str							,       *_lowerCAmelCase:       List[str]							,       **_lowerCAmelCase:       List[str]					):
         logger.info("pad is deprecated and will be removed in version 4.27. Please use pad_image instead."					)
         return self.pad_image(*_lowerCAmelCase							,       **_lowerCAmelCase					)






       def        SCREAMING_SNAKE_CASE     ( self:       Union[str, Any]							,       _lowerCAmelCase:       np.ndarray							,       _lowerCAmelCase:       Dict[str, int]							,       _lowerCAmelCase:       PILImageResampling = PILImageResampling.BICUBIC							,       _lowerCAmelCase:       Optional[Union[str, ChannelDimension]] = None							,       **_lowerCAmelCase:       int							,       ):
         lowercase						,     lowercase     :Any   						=    get_image_size(_lowerCAmelCase					)
         lowercase						,     lowercase     :List[str]   						=    size["height"], size["width"]

         # We always resize to the smallest of either the input or output size.
         lowercase     :Union[str, Any]   						=    min(_lowerCAmelCase							,       _lowerCAmelCase					)
         lowercase     :Any   						=    min(_lowerCAmelCase							,       _lowerCAmelCase					)

         if height == input_height and width == input_width:
           return image

         if input_height > input_width:
           lowercase     :Union[str, Any]   						=    int(input_width * height / input_height					)
         elif input_width > input_height:
           lowercase     :int   						=    int(input_height * width / input_width					)

         return resize(
             _lowerCAmelCase							,       size=(height, width)							,       resample=_lowerCAmelCase							,       reducing_gap=2.0							,       data_format=_lowerCAmelCase							,       **_lowerCAmelCase					)






       def        SCREAMING_SNAKE_CASE     ( self:       int							,       _lowerCAmelCase:       np.ndarray							,       _lowerCAmelCase:       Dict[str, int]							,       _lowerCAmelCase:       PILImageResampling = PILImageResampling.BICUBIC							,       _lowerCAmelCase:       Optional[Union[str, ChannelDimension]] = None							,       **_lowerCAmelCase:       str							,       ):
         lowercase     :Optional[Any]   						=    get_size_dict(_lowerCAmelCase					)
         lowercase     :Optional[Any]   						=    min(size["height"]							,       size["width"]					)
         lowercase     :Tuple   						=    get_resize_output_image_size(_lowerCAmelCase							,       size=_lowerCAmelCase							,       default_to_square=_lowerCAmelCase					)
         lowercase     :Optional[int]   						=    resize(_lowerCAmelCase							,       size=_lowerCAmelCase							,       resample=_lowerCAmelCase							,       data_format=_lowerCAmelCase							,       **_lowerCAmelCase					)
         return resized_image






       def        SCREAMING_SNAKE_CASE     ( self:       Dict							,       _lowerCAmelCase:       np.ndarray							,       _lowerCAmelCase:       Union[int, float]							,       _lowerCAmelCase:       Optional[Union[str, ChannelDimension]] = None							,       **_lowerCAmelCase:       List[Any]							,       ):
         return rescale(_lowerCAmelCase							,       scale=_lowerCAmelCase							,       data_format=_lowerCAmelCase							,       **_lowerCAmelCase					)






       def        SCREAMING_SNAKE_CASE     ( self:       Any							,       _lowerCAmelCase:       np.ndarray							,       _lowerCAmelCase:       Union[float, List[float]]							,       _lowerCAmelCase:       Union[float, List[float]]							,       _lowerCAmelCase:       Optional[Union[str, ChannelDimension]] = None							,       **_lowerCAmelCase:       Dict							,       ):
         return normalize(_lowerCAmelCase							,       mean=_lowerCAmelCase							,       std=_lowerCAmelCase							,       data_format=_lowerCAmelCase							,       **_lowerCAmelCase					)






       def        SCREAMING_SNAKE_CASE     ( self:       Tuple							,       _lowerCAmelCase:       ImageInput							,       _lowerCAmelCase:       bool = None							,       _lowerCAmelCase:       Dict[str, int] = None							,       _lowerCAmelCase:       PILImageResampling = None							,       _lowerCAmelCase:       bool = None							,       _lowerCAmelCase:       bool = None							,       _lowerCAmelCase:       bool = None							,       _lowerCAmelCase:       bool = False							,       _lowerCAmelCase:       bool = None							,       _lowerCAmelCase:       float = None							,       _lowerCAmelCase:       bool = None							,       _lowerCAmelCase:       Optional[Union[float, List[float]]] = None							,       _lowerCAmelCase:       Optional[Union[float, List[float]]] = None							,       _lowerCAmelCase:       Optional[Union[str, TensorType]] = None							,       _lowerCAmelCase:       Optional[ChannelDimension] = ChannelDimension.FIRST							,       **_lowerCAmelCase:       Optional[Any]							,       ):
         lowercase     :Union[str, Any]   						=    do_resize if do_resize is not None else self.do_resize
         lowercase     :Optional[int]   						=    size if size is not None else self.size
         if isinstance(_lowerCAmelCase							,       (tuple, list)					):
           # Previous feature extractor had size in (width, height) format
           lowercase     :List[str]   						=    size[::-1]
         lowercase     :List[str]   						=    get_size_dict(_lowerCAmelCase					)
         lowercase     :Optional[int]   						=    resample if resample is not None else self.resample
         lowercase     :Union[str, Any]   						=    do_thumbnail if do_thumbnail is not None else self.do_thumbnail
         lowercase     :str   						=    do_align_long_axis if do_align_long_axis is not None else self.do_align_long_axis
         lowercase     :int   						=    do_pad if do_pad is not None else self.do_pad
         lowercase     :Optional[Any]   						=    do_rescale if do_rescale is not None else self.do_rescale
         lowercase     :str   						=    rescale_factor if rescale_factor is not None else self.rescale_factor
         lowercase     :int   						=    do_normalize if do_normalize is not None else self.do_normalize
         lowercase     :Dict   						=    image_mean if image_mean is not None else self.image_mean
         lowercase     :str   						=    image_std if image_std is not None else self.image_std

         lowercase     :Any   						=    make_list_of_images(_lowerCAmelCase					)

         if not valid_images(_lowerCAmelCase					):
           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_rescale and rescale_factor is None:
           raise ValueError("Rescale factor must be specified if do_rescale is True."					)

         if do_pad and size is None:
           raise ValueError("Size must be specified if do_pad 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.
         lowercase     :Union[str, Any]   						=    [to_numpy_array(_lowerCAmelCase					) for image in images]

         if do_align_long_axis:
           lowercase     :Union[str, Any]   						=    [self.align_long_axis(_lowerCAmelCase							,       size=_lowerCAmelCase					) for image in images]

         if do_resize:
           lowercase     :Optional[Any]   						=    [self.resize(image=_lowerCAmelCase							,       size=_lowerCAmelCase							,       resample=_lowerCAmelCase					) for image in images]

         if do_thumbnail:
           lowercase     :str   						=    [self.thumbnail(image=_lowerCAmelCase							,       size=_lowerCAmelCase					) for image in images]

         if do_pad:
           lowercase     :List[Any]   						=    [self.pad_image(image=_lowerCAmelCase							,       size=_lowerCAmelCase							,       random_padding=_lowerCAmelCase					) for image in images]

         if do_rescale:
           lowercase     :Optional[Any]   						=    [self.rescale(image=_lowerCAmelCase							,       scale=_lowerCAmelCase					) for image in images]

         if do_normalize:
           lowercase     :Tuple   						=    [self.normalize(image=_lowerCAmelCase							,       mean=_lowerCAmelCase							,       std=_lowerCAmelCase					) for image in images]

         lowercase     :List[str]   						=    [to_channel_dimension_format(_lowerCAmelCase							,       _lowerCAmelCase					) for image in images]

         lowercase     :List[str]   						=    {"pixel_values": images}
         return BatchFeature(data=_lowerCAmelCase							,       tensor_type=_lowerCAmelCase					)



