code: 
  
  
  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, prepare_image_inputs
  
  
  if is_torch_available():
    import torch
  
  if is_vision_available():
    from PIL import Image
  
    from transformers import EfficientNetImageProcessor
  
  
  
  
  
  
  
  class 				__SCREAMING_SNAKE_CASE   (			unittest.TestCase   ):
  
  
        def __init__(							self							,						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__=13							,						SCREAMING_SNAKE_CASE__=3							,						SCREAMING_SNAKE_CASE__=18							,						SCREAMING_SNAKE_CASE__=30							,						SCREAMING_SNAKE_CASE__=400							,						SCREAMING_SNAKE_CASE__=True							,						SCREAMING_SNAKE_CASE__=None							,						SCREAMING_SNAKE_CASE__=True							,						SCREAMING_SNAKE_CASE__=[0.5, 0.5, 0.5]							,						SCREAMING_SNAKE_CASE__=[0.5, 0.5, 0.5]							,						):
              lowercase			:   Union[str, Any]					   =		size if size is not None else {'''height''': 18, '''width''': 18}
              lowercase			:   List[str]					   =		parent
              lowercase			:   int					   =		batch_size
              lowercase			:   List[str]					   =		num_channels
              lowercase			:   Any					   =		image_size
              lowercase			:   Any					   =		min_resolution
              lowercase			:   Optional[Any]					   =		max_resolution
              lowercase			:   Optional[Any]					   =		do_resize
              lowercase			:   Dict					   =		size
              lowercase			:   Optional[int]					   =		do_normalize
              lowercase			:   Union[str, Any]					   =		image_mean
              lowercase			:   Dict					   =		image_std
  
  
  
  
  
  
        def        __lowerCamelCase			(							self		):
              return {
                  "image_mean": self.image_mean,
                  "image_std": self.image_std,
                  "do_normalize": self.do_normalize,
                  "do_resize": self.do_resize,
                  "size": self.size,
              }
  
  
  
  
  
  
  
  @require_torch
  @require_vision
  class 				__SCREAMING_SNAKE_CASE   (			A__  ,						unittest.TestCase   ):
        A				:							List[str]    							=     EfficientNetImageProcessor if is_vision_available() else None
  
  
        def        __lowerCamelCase			(							self		):
              lowercase			:   Any					   =		EfficientNetImageProcessorTester(self		)
  
  
        @property
        def        __lowerCamelCase			(							self		):
              return self.image_processor_tester.prepare_image_processor_dict()
  
  
        def        __lowerCamelCase			(							self		):
              lowercase			:   List[str]					   =		self.image_processing_class(**self.image_processor_dict		)
              self.assertTrue(hasattr(SCREAMING_SNAKE_CASE__							,						'''image_mean'''		)		)
              self.assertTrue(hasattr(SCREAMING_SNAKE_CASE__							,						'''image_std'''		)		)
              self.assertTrue(hasattr(SCREAMING_SNAKE_CASE__							,						'''do_normalize'''		)		)
              self.assertTrue(hasattr(SCREAMING_SNAKE_CASE__							,						'''do_resize'''		)		)
              self.assertTrue(hasattr(SCREAMING_SNAKE_CASE__							,						'''size'''		)		)
  
  
        def        __lowerCamelCase			(							self		):
              lowercase			:   int					   =		self.image_processing_class.from_dict(self.image_processor_dict		)
              self.assertEqual(image_processor.size							,						{'''height''': 18, '''width''': 18}		)
  
              lowercase			:   Dict					   =		self.image_processing_class.from_dict(self.image_processor_dict							,						size=42		)
              self.assertEqual(image_processor.size							,						{'''height''': 42, '''width''': 42}		)
  
  
        def        __lowerCamelCase			(							self		):
              # Initialize image_processing
              lowercase			:   Union[str, Any]					   =		self.image_processing_class(**self.image_processor_dict		)
              # create random PIL images
              lowercase			:   str					   =		prepare_image_inputs(self.image_processor_tester							,						equal_resolution=SCREAMING_SNAKE_CASE__		)
              for image in image_inputs:
                    self.assertIsInstance(SCREAMING_SNAKE_CASE__							,						Image.Image		)
  
              # Test not batched input
              lowercase			:   List[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.size['''height'''],
                      self.image_processor_tester.size['''width'''],
                  )							,						)
  
              # Test batched
              lowercase			:   Any					   =		image_processing(SCREAMING_SNAKE_CASE__							,						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.size['''height'''],
                      self.image_processor_tester.size['''width'''],
                  )							,						)
  
  
        def        __lowerCamelCase			(							self		):
              # Initialize image_processing
              lowercase			:   Dict					   =		self.image_processing_class(**self.image_processor_dict		)
              # create random numpy tensors
              lowercase			:   Optional[int]					   =		prepare_image_inputs(self.image_processor_tester							,						equal_resolution=SCREAMING_SNAKE_CASE__							,						numpify=SCREAMING_SNAKE_CASE__		)
              for image in image_inputs:
                    self.assertIsInstance(SCREAMING_SNAKE_CASE__							,						np.ndarray		)
  
              # Test not batched input
              lowercase			:   List[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.size['''height'''],
                      self.image_processor_tester.size['''width'''],
                  )							,						)
  
              # Test batched
              lowercase			:   str					   =		image_processing(SCREAMING_SNAKE_CASE__							,						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.size['''height'''],
                      self.image_processor_tester.size['''width'''],
                  )							,						)
  
  
  
  
  
  
        def        __lowerCamelCase			(							self		):
              # Initialize image_processing
              lowercase			:   Optional[int]					   =		self.image_processing_class(**self.image_processor_dict		)
              # create random PyTorch tensors
              lowercase			:   Union[str, Any]					   =		prepare_image_inputs(self.image_processor_tester							,						equal_resolution=SCREAMING_SNAKE_CASE__							,						torchify=SCREAMING_SNAKE_CASE__		)
              for image in image_inputs:
                    self.assertIsInstance(SCREAMING_SNAKE_CASE__							,						torch.Tensor		)
  
              # Test not batched input
              lowercase			:   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.size['''height'''],
                      self.image_processor_tester.size['''width'''],
                  )							,						)
  
              # Test batched
              lowercase			:   Union[str, Any]					   =		image_processing(SCREAMING_SNAKE_CASE__							,						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.size['''height'''],
                      self.image_processor_tester.size['''width'''],
                  )							,						)
  
  
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
  
  
  __a   				=      {'''configuration_yoso''': ['''YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''YosoConfig''']}
  
  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    __a   				=      [
        '''YOSO_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''YosoForMaskedLM''',
        '''YosoForMultipleChoice''',
        '''YosoForQuestionAnswering''',
        '''YosoForSequenceClassification''',
        '''YosoForTokenClassification''',
        '''YosoLayer''',
        '''YosoModel''',
        '''YosoPreTrainedModel''',
    ]
  
  
  if TYPE_CHECKING:
    from .configuration_yoso import YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP, YosoConfig
  
    try:
      if not is_torch_available():
        raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
      pass
    else:
      from .modeling_yoso import (
          YOSO_PRETRAINED_MODEL_ARCHIVE_LIST,
          YosoForMaskedLM,
          YosoForMultipleChoice,
          YosoForQuestionAnswering,
          YosoForSequenceClassification,
          YosoForTokenClassification,
          YosoLayer,
          YosoModel,
          YosoPreTrainedModel,
      )
  
  
  else:
    import sys
  
    __a   				=      _LazyModule(__name__, globals()['''__file__'''], _import_structure)
  
  