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 DeiTImageProcessor
  
  
  
  
  
  class        lowercase_				( unittest.TestCase):
  
  
  
  
  
  
  							"""simple docstring"""
  
  
  
  
  
  
  
  							def __init__(   self			,    _UpperCAmelCase			,    _UpperCAmelCase=7			,    _UpperCAmelCase=3			,    _UpperCAmelCase=18			,    _UpperCAmelCase=30			,    _UpperCAmelCase=400			,    _UpperCAmelCase=True			,    _UpperCAmelCase=None			,    _UpperCAmelCase=True			,    _UpperCAmelCase=None			,    _UpperCAmelCase=True			,    _UpperCAmelCase=[0.5, 0.5, 0.5]			,    _UpperCAmelCase=[0.5, 0.5, 0.5]			,    ):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													a_					=		size if size is not None else {"""height""": 20, """width""": 20}
  													a_					=		crop_size if crop_size is not None else {"""height""": 18, """width""": 18}
  
  													a_					=		parent
  													a_					=		batch_size
  													a_					=		num_channels
  													a_					=		image_size
  													a_					=		min_resolution
  													a_					=		max_resolution
  													a_					=		do_resize
  													a_					=		size
  													a_					=		do_center_crop
  													a_					=		crop_size
  													a_					=		do_normalize
  													a_					=		image_mean
  													a_					=		image_std
  
  
  
  
  
  
  							def 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""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,
  													}
  
  
  
  
  
  @require_torch
  @require_vision
  class        lowercase_				( UpperCamelCase__			,unittest.TestCase):
  
  
  
  
  
  
  							"""simple docstring"""
  
  
  
  
  
  
  
  							snake_case_        =		DeiTImageProcessor if is_vision_available() else None
  							snake_case_        =		True
  
  
  							def 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													a_					=		DeiTImageProcessingTester(self		)
  
  
  							@property
  							def 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													return self.image_processor_tester.prepare_image_processor_dict()
  
  
  							def 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													a_					=		self.image_processing_class(**self.image_processor_dict		)
  													self.assertTrue(hasattr(_UpperCAmelCase			,    """do_resize"""		)		)
  													self.assertTrue(hasattr(_UpperCAmelCase			,    """size"""		)		)
  													self.assertTrue(hasattr(_UpperCAmelCase			,    """do_center_crop"""		)		)
  													self.assertTrue(hasattr(_UpperCAmelCase			,    """center_crop"""		)		)
  													self.assertTrue(hasattr(_UpperCAmelCase			,    """do_normalize"""		)		)
  													self.assertTrue(hasattr(_UpperCAmelCase			,    """image_mean"""		)		)
  													self.assertTrue(hasattr(_UpperCAmelCase			,    """image_std"""		)		)
  
  
  							def 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													a_					=		self.image_processing_class.from_dict(self.image_processor_dict		)
  													self.assertEqual(image_processor.size			,    {"""height""": 20, """width""": 20}		)
  													self.assertEqual(image_processor.crop_size			,    {"""height""": 18, """width""": 18}		)
  
  													a_					=		self.image_processing_class.from_dict(self.image_processor_dict			,    size=42			,    crop_size=84		)
  													self.assertEqual(image_processor.size			,    {"""height""": 42, """width""": 42}		)
  													self.assertEqual(image_processor.crop_size			,    {"""height""": 84, """width""": 84}		)
  
  
  							def 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													pass
  
  
  							def 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													a_					=		self.image_processing_class(**self.image_processor_dict		)
  													# create random PIL images
  													a_					=		prepare_image_inputs(self.image_processor_tester			,    equal_resolution=_UpperCAmelCase		)
  													for image in image_inputs:
  																			self.assertIsInstance(_UpperCAmelCase			,    Image.Image		)
  
  													# Test not batched input
  													a_					=		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
  													a_					=		image_processing(_UpperCAmelCase			,    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 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													a_					=		self.image_processing_class(**self.image_processor_dict		)
  													# create random numpy tensors
  													a_					=		prepare_image_inputs(self.image_processor_tester			,    equal_resolution=_UpperCAmelCase			,    numpify=_UpperCAmelCase		)
  													for image in image_inputs:
  																			self.assertIsInstance(_UpperCAmelCase			,    np.ndarray		)
  
  													# Test not batched input
  													a_					=		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
  													a_					=		image_processing(_UpperCAmelCase			,    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 						lowercase__     (   self		):
  
  
  
  
  
  
  
  													"""simple docstring"""
  
  
  													a_					=		self.image_processing_class(**self.image_processor_dict		)
  													# create random PyTorch tensors
  													a_					=		prepare_image_inputs(self.image_processor_tester			,    equal_resolution=_UpperCAmelCase			,    torchify=_UpperCAmelCase		)
  													for image in image_inputs:
  																			self.assertIsInstance(_UpperCAmelCase			,    torch.Tensor		)
  
  													# Test not batched input
  													a_					=		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
  													a_					=		image_processing(_UpperCAmelCase			,    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"""],
  													    )			,    )
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
  
  
  A_    :					Optional[Any]             ={
      """configuration_wav2vec2_conformer""": [
          """WAV2VEC2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
          """Wav2Vec2ConformerConfig""",
      ],
  }
  
  
  try:
  	if not is_torch_available():
  		raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  	pass
  else:
  	A_    :					Union[str, Any]             =[
  	    """WAV2VEC2_CONFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
  	    """Wav2Vec2ConformerForAudioFrameClassification""",
  	    """Wav2Vec2ConformerForCTC""",
  	    """Wav2Vec2ConformerForPreTraining""",
  	    """Wav2Vec2ConformerForSequenceClassification""",
  	    """Wav2Vec2ConformerForXVector""",
  	    """Wav2Vec2ConformerModel""",
  	    """Wav2Vec2ConformerPreTrainedModel""",
  	]
  
  if TYPE_CHECKING:
  	from .configuration_wavaveca_conformer import (
  	    WAV2VEC2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
  	    WavaVecaConformerConfig,
  	)
  
  	try:
  		if not is_torch_available():
  			raise OptionalDependencyNotAvailable()
  	except OptionalDependencyNotAvailable:
  		pass
  	else:
  		from .modeling_wavaveca_conformer import (
  		    WAV2VEC2_CONFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
  		    WavaVecaConformerForAudioFrameClassification,
  		    WavaVecaConformerForCTC,
  		    WavaVecaConformerForPreTraining,
  		    WavaVecaConformerForSequenceClassification,
  		    WavaVecaConformerForXVector,
  		    WavaVecaConformerModel,
  		    WavaVecaConformerPreTrainedModel,
  		)
  
  else:
  	import sys
  
  	A_    :					Union[str, Any]             =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)