

from __future__ import annotations

import unittest

from transformers import OpenAIGPTConfig, 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.openai.modeling_tf_openai import (
     TF_OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST,
     TFOpenAIGPTDoubleHeadsModel,
     TFOpenAIGPTForSequenceClassification,
     TFOpenAIGPTLMHeadModel,
     TFOpenAIGPTModel,
 )




class A  :






      def __init__( self						:					Any      ,       lowercase_						:					Dict      ,       ) ->						Dict:
             """simple docstring"""




             _lowerCamelCase	:		List[str]          =parent
             _lowerCamelCase	:		List[str]          =13
             _lowerCamelCase	:		Union[str, Any]          =7
             _lowerCamelCase	:		Optional[Any]          =True
             _lowerCamelCase	:		str          =True
             _lowerCamelCase	:		List[str]          =True
             _lowerCamelCase	:		int          =True
             _lowerCamelCase	:		Tuple          =True
             _lowerCamelCase	:		int          =99
             _lowerCamelCase	:		Union[str, Any]          =32
             _lowerCamelCase	:		Union[str, Any]          =2
             _lowerCamelCase	:		Optional[Any]          =4
             _lowerCamelCase	:		Optional[Any]          =37
             _lowerCamelCase	:		Dict          ='gelu'
             _lowerCamelCase	:		List[Any]          =0.1
             _lowerCamelCase	:		Dict          =0.1
             _lowerCamelCase	:		str          =512
             _lowerCamelCase	:		Tuple          =16
             _lowerCamelCase	:		Union[str, Any]          =2
             _lowerCamelCase	:		Tuple          =0.02
             _lowerCamelCase	:		str          =3
             _lowerCamelCase	:		List[str]          =4
             _lowerCamelCase	:		Dict          =None
             _lowerCamelCase	:		str          =self.vocab_size - 1






      def 	lowerCamelCase	( self						:					Dict			) ->						Tuple:
             """simple docstring"""




             _lowerCamelCase	:		Any          =ids_tensor([self.batch_size, self.seq_length]      ,       self.vocab_size			)

             _lowerCamelCase	:		Any          =None
             if self.use_input_mask:
                    _lowerCamelCase	:		List[str]          =random_attention_mask([self.batch_size, self.seq_length]			)

             _lowerCamelCase	:		Tuple          =None
             if self.use_token_type_ids:
                    _lowerCamelCase	:		List[Any]          =ids_tensor([self.batch_size, self.seq_length]      ,       self.type_vocab_size			)

             _lowerCamelCase	:		Dict          =None
             if self.use_mc_token_ids:
                    _lowerCamelCase	:		Union[str, Any]          =ids_tensor([self.batch_size, self.num_choices]      ,       self.seq_length			)

             _lowerCamelCase	:		str          =None
             _lowerCamelCase	:		Any          =None
             _lowerCamelCase	:		List[Any]          =None
             if self.use_labels:
                    _lowerCamelCase	:		Dict          =ids_tensor([self.batch_size]      ,       self.type_sequence_label_size			)
                    _lowerCamelCase	:		Dict          =ids_tensor([self.batch_size, self.seq_length]      ,       self.num_labels			)
                    _lowerCamelCase	:		List[str]          =ids_tensor([self.batch_size]      ,       self.num_choices			)

             _lowerCamelCase	:		str          =OpenAIGPTConfig(
                 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	:		Any          =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 	lowerCamelCase	( self						:					Tuple      ,       lowercase_						:					int      ,       lowercase_						:					Dict      ,       lowercase_						:					Dict      ,       lowercase_						:					List[Any]      ,       lowercase_						:					str      ,       *lowercase_						:					int			) ->						int:
             """simple docstring"""




             _lowerCamelCase	:		Optional[Any]          =TFOpenAIGPTModel(config=lowercase_			)
             _lowerCamelCase	:		Tuple          ={'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
             _lowerCamelCase	:		List[str]          =model(lowercase_			)

             _lowerCamelCase	:		str          =[input_ids, input_mask]
             _lowerCamelCase	:		str          =model(lowercase_			)

             _lowerCamelCase	:		List[Any]          =model(lowercase_			)

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






      def 	lowerCamelCase	( self						:					int      ,       lowercase_						:					Optional[Any]      ,       lowercase_						:					Dict      ,       lowercase_						:					List[Any]      ,       lowercase_						:					Tuple      ,       lowercase_						:					Union[str, Any]      ,       *lowercase_						:					List[str]			) ->						Union[str, Any]:
             """simple docstring"""




             _lowerCamelCase	:		Any          =TFOpenAIGPTLMHeadModel(config=lowercase_			)
             _lowerCamelCase	:		Tuple          ={'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
             _lowerCamelCase	:		Union[str, Any]          =model(lowercase_			)
             self.parent.assertEqual(result.logits.shape      ,       (self.batch_size, self.seq_length, self.vocab_size)			)






      def 	lowerCamelCase	( self						:					Any      ,       lowercase_						:					int      ,       lowercase_						:					List[str]      ,       lowercase_						:					Optional[Any]      ,       lowercase_						:					Dict      ,       lowercase_						:					int      ,       lowercase_						:					List[Any]      ,       *lowercase_						:					List[str]			) ->						Dict:
             """simple docstring"""




             _lowerCamelCase	:		Dict          =TFOpenAIGPTDoubleHeadsModel(config=lowercase_			)

             _lowerCamelCase	:		Union[str, Any]          =tf.tile(tf.expand_dims(lowercase_      ,       1			)      ,       (1, self.num_choices, 1)			)
             _lowerCamelCase	:		Dict          =tf.tile(tf.expand_dims(lowercase_      ,       1			)      ,       (1, self.num_choices, 1)			)
             _lowerCamelCase	:		Union[str, Any]          =tf.tile(tf.expand_dims(lowercase_      ,       1			)      ,       (1, self.num_choices, 1)			)

             _lowerCamelCase	:		Optional[int]          ={
                 'input_ids': multiple_choice_inputs_ids,
                 'mc_token_ids': mc_token_ids,
                 'attention_mask': multiple_choice_input_mask,
                 'token_type_ids': multiple_choice_token_type_ids,
             }
             _lowerCamelCase	:		Optional[Any]          =model(lowercase_			)
             self.parent.assertEqual(
                 result.logits.shape      ,       (self.batch_size, self.num_choices, self.seq_length, self.vocab_size)			)
             self.parent.assertEqual(result.mc_logits.shape      ,       (self.batch_size, self.num_choices)			)






      def 	lowerCamelCase	( self						:					Union[str, Any]      ,       lowercase_						:					Any      ,       lowercase_						:					Union[str, Any]      ,       lowercase_						:					Optional[int]      ,       lowercase_						:					int      ,       lowercase_						:					List[Any]      ,       *lowercase_						:					List[Any]			) ->						List[Any]:
             """simple docstring"""




             _lowerCamelCase	:		Tuple          =self.num_labels
             _lowerCamelCase	:		Optional[int]          =ids_tensor([self.batch_size]      ,       self.type_sequence_label_size			)
             _lowerCamelCase	:		List[str]          ={
                 'input_ids': input_ids,
                 'attention_mask': input_mask,
                 'token_type_ids': token_type_ids,
                 'labels': sequence_labels,
             }
             _lowerCamelCase	:		Union[str, Any]          =TFOpenAIGPTForSequenceClassification(lowercase_			)
             _lowerCamelCase	:		Dict          =model(lowercase_			)
             self.parent.assertEqual(result.logits.shape      ,       (self.batch_size, self.num_labels)			)






      def 	lowerCamelCase	( self						:					List[str]			) ->						Any:
             """simple docstring"""




             _lowerCamelCase	:		Tuple          =self.prepare_config_and_inputs()

             (
                 _lowerCamelCase					
             )	:		Tuple          =config_and_inputs

             _lowerCamelCase	:		List[Any]          ={'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
             return config, inputs_dict




@require_tf
class A  (       UpperCamelCase_   ,							UpperCamelCase_   ,							unittest.TestCase					):
      UpperCamelCase__							:  Union[str, Any]				=(
          (TFOpenAIGPTModel, TFOpenAIGPTLMHeadModel, TFOpenAIGPTDoubleHeadsModel, TFOpenAIGPTForSequenceClassification)
          if is_tf_available()
          else ()
      )
      UpperCamelCase__							:  Tuple				=(
          (TFOpenAIGPTLMHeadModel,) if is_tf_available() else ()
      )  # TODO (PVP): Add Double HeadsModel when generate() function is changed accordingly
      UpperCamelCase__							:  str				=(
          {
              'feature-extraction': TFOpenAIGPTModel,
              'text-classification': TFOpenAIGPTForSequenceClassification,
              'text-generation': TFOpenAIGPTLMHeadModel,
              'zero-shot': TFOpenAIGPTForSequenceClassification,
          }
          if is_tf_available()
          else {}
      )
      UpperCamelCase__							:  Union[str, Any]				=False
      UpperCamelCase__							:  Dict				=False






      def 	lowerCamelCase	( self						:					Optional[Any]      ,       lowercase_						:					Union[str, Any]      ,       lowercase_						:					Optional[int]      ,       lowercase_						:					List[str]      ,       lowercase_						:					List[Any]      ,       lowercase_						:					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.
                    # `OpenAIGPTConfig` 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 	lowerCamelCase	( self						:					Optional[Any]			) ->						Tuple:
             """simple docstring"""




             _lowerCamelCase	:		Optional[int]          =TFOpenAIGPTModelTester(self			)
             _lowerCamelCase	:		int          =ConfigTester(self      ,       config_class=lowercase_      ,       n_embd=37			)






      def 	lowerCamelCase	( self						:					Any			) ->						List[str]:
             """simple docstring"""




             self.config_tester.run_common_tests()






      def 	lowerCamelCase	( self						:					str			) ->						List[Any]:
             """simple docstring"""




             _lowerCamelCase	:		Optional[Any]          =self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_openai_gpt_model(*lowercase_			)






      def 	lowerCamelCase	( self						:					str			) ->						Optional[int]:
             """simple docstring"""




             _lowerCamelCase	:		str          =self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_openai_gpt_lm_head(*lowercase_			)






      def 	lowerCamelCase	( self						:					Optional[Any]			) ->						List[Any]:
             """simple docstring"""




             _lowerCamelCase	:		Tuple          =self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_openai_gpt_double_head(*lowercase_			)






      def 	lowerCamelCase	( self						:					Optional[Any]			) ->						Optional[int]:
             """simple docstring"""




             _lowerCamelCase	:		Optional[Any]          =self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_openai_gpt_for_sequence_classification(*lowercase_			)






      @slow
      def 	lowerCamelCase	( self						:					List[str]			) ->						Any:
             """simple docstring"""




             for model_name in TF_OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                    _lowerCamelCase	:		Union[str, Any]          =TFOpenAIGPTModel.from_pretrained(lowercase_			)
                    self.assertIsNotNone(lowercase_			)




@require_tf
class A  (       unittest.TestCase					):






      @slow
      def 	lowerCamelCase	( self						:					Optional[int]			) ->						Union[str, Any]:
             """simple docstring"""




             _lowerCamelCase	:		Optional[int]          =TFOpenAIGPTLMHeadModel.from_pretrained('openai-gpt'			)
             _lowerCamelCase	:		Optional[int]          =tf.convert_to_tensor([[481, 4735, 544]]      ,       dtype=tf.intaa			)  # the president is
             _lowerCamelCase	:		Optional[int]          =[
                 481,
                 4735,
                 544,
                 246,
                 963,
                 870,
                 762,
                 239,
                 244,
                 4_0477,
                 244,
                 249,
                 719,
                 881,
                 487,
                 544,
                 240,
                 244,
                 603,
                 481,
             ]  # the president is a very good man. " \n " i\'m sure he is, " said the

             _lowerCamelCase	:		int          =model.generate(lowercase_      ,       do_sample=lowercase_			)
             self.assertListEqual(output_ids[0].numpy().tolist()      ,       lowercase_			)






import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin


if is_torch_available():
 import torch

if is_vision_available():
 from PIL import Image

 from transformers import CLIPImageProcessor




class A  (       unittest.TestCase					):






      def __init__( self						:					Union[str, Any]      ,       lowercase_						:					Any      ,       lowercase_						:					Optional[Any]=7      ,       lowercase_						:					Union[str, Any]=3      ,       lowercase_						:					Any=18      ,       lowercase_						:					Optional[int]=30      ,       lowercase_						:					int=400      ,       lowercase_						:					List[Any]=True      ,       lowercase_						:					List[str]=None      ,       lowercase_						:					Optional[Any]=True      ,       lowercase_						:					Tuple=None      ,       lowercase_						:					str=True      ,       lowercase_						:					Any=[0.48145466, 0.4578275, 0.40821073]      ,       lowercase_						:					Optional[int]=[0.26862954, 0.26130258, 0.27577711]      ,       lowercase_						:					Dict=True      ,       ) ->						str:
             """simple docstring"""




             _lowerCamelCase	:		List[str]          =size if size is not None else {'shortest_edge': 20}
             _lowerCamelCase	:		Optional[Any]          =crop_size if crop_size is not None else {'height': 18, 'width': 18}
             _lowerCamelCase	:		Any          =parent
             _lowerCamelCase	:		List[Any]          =batch_size
             _lowerCamelCase	:		Union[str, Any]          =num_channels
             _lowerCamelCase	:		str          =image_size
             _lowerCamelCase	:		str          =min_resolution
             _lowerCamelCase	:		Optional[int]          =max_resolution
             _lowerCamelCase	:		str          =do_resize
             _lowerCamelCase	:		Tuple          =size
             _lowerCamelCase	:		Any          =do_center_crop
             _lowerCamelCase	:		Any          =crop_size
             _lowerCamelCase	:		Optional[Any]          =do_normalize
             _lowerCamelCase	:		List[Any]          =image_mean
             _lowerCamelCase	:		int          =image_std
             _lowerCamelCase	:		Any          =do_convert_rgb






      def 	lowerCamelCase	( self						:					int			) ->						Tuple:
             """simple docstring"""




             return {
                 "do_resize": self.do_resize,
                 "size": self.size,
                 "do_center_crop": self.do_center_crop,
                 "crop_size": self.crop_size,
                 "do_normalize": self.do_normalize,
                 "image_mean": self.image_mean,
                 "image_std": self.image_std,
                 "do_convert_rgb": self.do_convert_rgb,
             }






      def 	lowerCamelCase	( self						:					List[str]      ,       lowercase_						:					Any=False      ,       lowercase_						:					str=False      ,       lowercase_						:					Union[str, Any]=False			) ->						Tuple:
             """simple docstring"""




             assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

             if equal_resolution:
                    _lowerCamelCase	:		int          =[]
                    for i in range(self.batch_size			):
                           image_inputs.append(
                               np.random.randint(
                                   255      ,       size=(self.num_channels, self.max_resolution, self.max_resolution)      ,       dtype=np.uinta			)			)
             else:
                    _lowerCamelCase	:		Dict          =[]
                    for i in range(self.batch_size			):
                           _lowerCamelCase     ,					_lowerCamelCase	:		str          =np.random.choice(np.arange(self.min_resolution      ,       self.max_resolution			)      ,       2			)
                           image_inputs.append(np.random.randint(255      ,       size=(self.num_channels, width, height)      ,       dtype=np.uinta			)			)

             if not numpify and not torchify:
                    # PIL expects the channel dimension as last dimension
                    _lowerCamelCase	:		Optional[int]          =[Image.fromarray(np.moveaxis(lowercase_      ,       0      ,       -1			)			) for x in image_inputs]

             if torchify:
                    _lowerCamelCase	:		Tuple          =[torch.from_numpy(lowercase_			) for x in image_inputs]

             return image_inputs




@require_torch
@require_vision
class A  (       UpperCamelCase_   ,							unittest.TestCase					):
      UpperCamelCase__							:  Tuple				=CLIPImageProcessor if is_vision_available() else None






      def 	lowerCamelCase	( self						:					Optional[Any]			) ->						Dict:
             """simple docstring"""




             _lowerCamelCase	:		Tuple          =CLIPImageProcessingTester(self			)






      @property
      def 	lowerCamelCase	( self						:					Tuple			) ->						Dict:
             """simple docstring"""




             return self.image_processor_tester.prepare_image_processor_dict()






      def 	lowerCamelCase	( self						:					int			) ->						str:
             """simple docstring"""




             _lowerCamelCase	:		Optional[int]          =self.image_processing_class(**self.image_processor_dict			)
             self.assertTrue(hasattr(lowercase_      ,       'do_resize'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'size'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'do_center_crop'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'center_crop'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'do_normalize'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'image_mean'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'image_std'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'do_convert_rgb'			)			)






      def 	lowerCamelCase	( self						:					Any			) ->						Tuple:
             """simple docstring"""




             _lowerCamelCase	:		int          =self.image_processing_class.from_dict(self.image_processor_dict			)
             self.assertEqual(image_processor.size      ,       {'shortest_edge': 20}			)
             self.assertEqual(image_processor.crop_size      ,       {'height': 18, 'width': 18}			)

             _lowerCamelCase	:		Optional[Any]          =self.image_processing_class.from_dict(self.image_processor_dict      ,       size=42      ,       crop_size=84			)
             self.assertEqual(image_processor.size      ,       {'shortest_edge': 42}			)
             self.assertEqual(image_processor.crop_size      ,       {'height': 84, 'width': 84}			)






      def 	lowerCamelCase	( self						:					Tuple			) ->						Optional[Any]:
             """simple docstring"""




             pass






      def 	lowerCamelCase	( self						:					List[Any]			) ->						Union[str, Any]:
             """simple docstring"""




             _lowerCamelCase	:		str          =self.image_processing_class(**self.image_processor_dict			)
             # create random PIL images
             _lowerCamelCase	:		Any          =self.image_processor_tester.prepare_inputs(equal_resolution=lowercase_			)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_      ,       Image.Image			)

             # Test not batched input
             _lowerCamelCase	:		Optional[Any]          =image_processing(image_inputs[0]      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     1,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )

             # Test batched
             _lowerCamelCase	:		Optional[Any]          =image_processing(lowercase_      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )






      def 	lowerCamelCase	( self						:					List[Any]			) ->						Optional[int]:
             """simple docstring"""




             _lowerCamelCase	:		Tuple          =self.image_processing_class(**self.image_processor_dict			)
             # create random numpy tensors
             _lowerCamelCase	:		Tuple          =self.image_processor_tester.prepare_inputs(equal_resolution=lowercase_      ,       numpify=lowercase_			)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_      ,       np.ndarray			)

             # Test not batched input
             _lowerCamelCase	:		Any          =image_processing(image_inputs[0]      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     1,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )

             # Test batched
             _lowerCamelCase	:		str          =image_processing(lowercase_      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )






      def 	lowerCamelCase	( self						:					List[str]			) ->						Tuple:
             """simple docstring"""




             _lowerCamelCase	:		int          =self.image_processing_class(**self.image_processor_dict			)
             # create random PyTorch tensors
             _lowerCamelCase	:		Dict          =self.image_processor_tester.prepare_inputs(equal_resolution=lowercase_      ,       torchify=lowercase_			)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_      ,       torch.Tensor			)

             # Test not batched input
             _lowerCamelCase	:		List[str]          =image_processing(image_inputs[0]      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     1,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )

             # Test batched
             _lowerCamelCase	:		str          =image_processing(lowercase_      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     self.image_processor_tester.batch_size,
                     self.image_processor_tester.num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )




@require_torch
@require_vision
class A  (       UpperCamelCase_   ,							unittest.TestCase					):
      UpperCamelCase__							:  List[str]				=CLIPImageProcessor if is_vision_available() else None






      def 	lowerCamelCase	( self						:					Union[str, Any]			) ->						str:
             """simple docstring"""




             _lowerCamelCase	:		int          =CLIPImageProcessingTester(self      ,       num_channels=4			)
             _lowerCamelCase	:		Any          =3






      @property
      def 	lowerCamelCase	( self						:					Union[str, Any]			) ->						Tuple:
             """simple docstring"""




             return self.image_processor_tester.prepare_image_processor_dict()






      def 	lowerCamelCase	( self						:					Optional[Any]			) ->						Any:
             """simple docstring"""




             _lowerCamelCase	:		Tuple          =self.image_processing_class(**self.image_processor_dict			)
             self.assertTrue(hasattr(lowercase_      ,       'do_resize'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'size'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'do_center_crop'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'center_crop'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'do_normalize'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'image_mean'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'image_std'			)			)
             self.assertTrue(hasattr(lowercase_      ,       'do_convert_rgb'			)			)






      def 	lowerCamelCase	( self						:					Optional[int]			) ->						Optional[int]:
             """simple docstring"""




             pass






      def 	lowerCamelCase	( self						:					Any			) ->						Any:
             """simple docstring"""




             _lowerCamelCase	:		Union[str, Any]          =self.image_processing_class(**self.image_processor_dict			)
             # create random PIL images
             _lowerCamelCase	:		Optional[Any]          =self.image_processor_tester.prepare_inputs(equal_resolution=lowercase_			)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_      ,       Image.Image			)

             # Test not batched input
             _lowerCamelCase	:		Any          =image_processing(image_inputs[0]      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     1,
                     self.expected_encoded_image_num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )

             # Test batched
             _lowerCamelCase	:		Optional[Any]          =image_processing(lowercase_      ,       return_tensors='pt'			).pixel_values
             self.assertEqual(
                 encoded_images.shape      ,       (
                     self.image_processor_tester.batch_size,
                     self.expected_encoded_image_num_channels,
                     self.image_processor_tester.crop_size['height'],
                     self.image_processor_tester.crop_size['width'],
                 )      ,       )


