"""simple docstring"""







import collections
import inspect
import unittest
from typing import Dict, List, Tuple

from transformers import MaskFormerSwinConfig
from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device
from transformers.utils import is_torch_available

from ...test_backbone_common import BackboneTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
       import torch
       from torch import nn

       from transformers import MaskFormerSwinBackbone
       from transformers.models.maskformer import MaskFormerSwinModel







class  UpperCamelCase	:
   def __init__(    self  ,__UpperCamelCase  ,__UpperCamelCase=13  ,__UpperCamelCase=32  ,__UpperCamelCase=2  ,__UpperCamelCase=3  ,__UpperCamelCase=16  ,__UpperCamelCase=[1, 2, 1]  ,__UpperCamelCase=[2, 2, 4]  ,__UpperCamelCase=2  ,__UpperCamelCase=2.0  ,__UpperCamelCase=True  ,__UpperCamelCase=0.0  ,__UpperCamelCase=0.0  ,__UpperCamelCase=0.1  ,__UpperCamelCase="gelu"  ,__UpperCamelCase=False  ,__UpperCamelCase=True  ,__UpperCamelCase=0.02  ,__UpperCamelCase=1e-5  ,__UpperCamelCase=True  ,__UpperCamelCase=None  ,__UpperCamelCase=True  ,__UpperCamelCase=10  ,__UpperCamelCase=8  ,__UpperCamelCase=["stage1", "stage2", "stage3"]  ,__UpperCamelCase=[1, 2, 3]  ,)			->   Any:


        '''simple docstring'''


        lowercase_			:       Union[str, Any]									=			parent
        lowercase_			:       Any									=			batch_size
        lowercase_			:       Any									=			image_size
        lowercase_			:       Optional[Any]									=			patch_size
        lowercase_			:       List[Any]									=			num_channels
        lowercase_			:       List[Any]									=			embed_dim
        lowercase_			:       str									=			depths
        lowercase_			:       int									=			num_heads
        lowercase_			:       Union[str, Any]									=			window_size
        lowercase_			:       List[Any]									=			mlp_ratio
        lowercase_			:       Dict									=			qkv_bias
        lowercase_			:       Tuple									=			hidden_dropout_prob
        lowercase_			:       Optional[Any]									=			attention_probs_dropout_prob
        lowercase_			:       Tuple									=			drop_path_rate
        lowercase_			:       Dict									=			hidden_act
        lowercase_			:       Optional[Any]									=			use_absolute_embeddings
        lowercase_			:       Dict									=			patch_norm
        lowercase_			:       List[str]									=			layer_norm_eps
        lowercase_			:       Optional[int]									=			initializer_range
        lowercase_			:       int									=			is_training
        lowercase_			:       int									=			scope
        lowercase_			:       int									=			use_labels
        lowercase_			:       str									=			type_sequence_label_size
        lowercase_			:       Dict									=			encoder_stride
        lowercase_			:       Any									=			out_features
        lowercase_			:       Optional[Any]									=			out_indices
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        lowercase_			:       Union[str, Any]									=			floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]    )

        lowercase_			:       Union[str, Any]									=			None
        if self.use_labels:
             lowercase_			:       int									=			ids_tensor([self.batch_size]  ,self.type_sequence_label_size    )

        lowercase_			:       str									=			self.get_config()

        return config, pixel_values, labels
   def     _UpperCAmelCase     (    self    )			->   Dict:


        '''simple docstring'''


        return MaskFormerSwinConfig(
            image_size=self.image_size  ,patch_size=self.patch_size  ,num_channels=self.num_channels  ,embed_dim=self.embed_dim  ,depths=self.depths  ,num_heads=self.num_heads  ,window_size=self.window_size  ,mlp_ratio=self.mlp_ratio  ,qkv_bias=self.qkv_bias  ,hidden_dropout_prob=self.hidden_dropout_prob  ,attention_probs_dropout_prob=self.attention_probs_dropout_prob  ,drop_path_rate=self.drop_path_rate  ,hidden_act=self.hidden_act  ,use_absolute_embeddings=self.use_absolute_embeddings  ,path_norm=self.patch_norm  ,layer_norm_eps=self.layer_norm_eps  ,initializer_range=self.initializer_range  ,encoder_stride=self.encoder_stride  ,out_features=self.out_features  ,out_indices=self.out_indices  ,)
   def     _UpperCAmelCase     (    self  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )			->   Optional[Any]:


        '''simple docstring'''


        lowercase_			:       List[str]									=			MaskFormerSwinModel(config=__UpperCamelCase    )
        model.to(__UpperCamelCase    )
        model.eval()
        lowercase_			:       Optional[Any]									=			model(__UpperCamelCase    )

        lowercase_			:       List[str]									=			((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths    ) - 1))
        lowercase_			:       Optional[int]									=			int(config.embed_dim * 2 ** (len(config.depths    ) - 1)    )

        self.parent.assertEqual(result.last_hidden_state.shape  ,(self.batch_size, expected_seq_len, expected_dim)    )
   def     _UpperCAmelCase     (    self  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )			->   Optional[int]:


        '''simple docstring'''


        lowercase_			:       List[str]									=			MaskFormerSwinBackbone(config=__UpperCamelCase    )
        model.to(__UpperCamelCase    )
        model.eval()
        lowercase_			:       str									=			model(__UpperCamelCase    )

        # verify feature maps
        self.parent.assertEqual(len(result.feature_maps    )  ,len(config.out_features    )    )
        self.parent.assertListEqual(list(result.feature_maps[0].shape    )  ,[13, 16, 16, 16]    )

        # verify channels
        self.parent.assertEqual(len(model.channels    )  ,len(config.out_features    )    )
        self.parent.assertListEqual(model.channels  ,[16, 32, 64]    )

        # verify ValueError
        with self.parent.assertRaises(__UpperCamelCase    ):
             lowercase_			:       Dict									=			['stem']
             lowercase_			:       List[str]									=			MaskFormerSwinBackbone(config=__UpperCamelCase    )







   def     _UpperCAmelCase     (    self    )			->   List[Any]:


        '''simple docstring'''


        lowercase_			:       Any									=			self.prepare_config_and_inputs()
        lowercase_			:       Optional[Any]									=			config_and_inputs
        lowercase_			:       Union[str, Any]									=			{'pixel_values': pixel_values}
        return config, inputs_dict







@require_torch
class  UpperCamelCase	(    lowercase_		,   lowercase_		,   unittest.TestCase						):
   lowercase							=						(
       (
           MaskFormerSwinModel,
           MaskFormerSwinBackbone,
       )
       if is_torch_available()
       else ()
   )
   lowercase							=						{'feature-extraction': MaskFormerSwinModel} if is_torch_available() else {}
   lowercase							=						False
   lowercase							=						False
   lowercase							=						False
   lowercase							=						False
   lowercase							=						False
   def     _UpperCAmelCase     (    self    )			->   Dict:


        '''simple docstring'''


        lowercase_			:       List[Any]									=			MaskFormerSwinModelTester(self    )
        lowercase_			:       Any									=			ConfigTester(self  ,config_class=__UpperCamelCase  ,embed_dim=37    )
   @require_torch_multi_gpu
   @unittest.skip(
       reason=(
           '`MaskFormerSwinModel` outputs `hidden_states_spatial_dimensions` which doesn\'t work well with'
           ' `nn.DataParallel`'
       )    )
   def     _UpperCAmelCase     (    self    )			->   List[str]:


        '''simple docstring'''


        pass
   def     _UpperCAmelCase     (    self    )			->   Optional[int]:


        '''simple docstring'''


        self.create_and_test_config_common_properties()
        self.config_tester.create_and_test_config_to_json_string()
        self.config_tester.create_and_test_config_to_json_file()
        self.config_tester.create_and_test_config_from_and_save_pretrained()
        self.config_tester.create_and_test_config_with_num_labels()
        self.config_tester.check_config_can_be_init_without_params()
        self.config_tester.check_config_arguments_init()
   def     _UpperCAmelCase     (    self    )			->   Optional[int]:


        '''simple docstring'''


        return
   def     _UpperCAmelCase     (    self    )			->   str:


        '''simple docstring'''


        lowercase_			:       int									=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_model(*__UpperCamelCase    )
   def     _UpperCAmelCase     (    self    )			->   Optional[int]:


        '''simple docstring'''


        lowercase_			:       Dict									=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_backbone(*__UpperCamelCase    )
   @unittest.skip('Swin does not use inputs_embeds'    )
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        pass
   @unittest.skip('Swin does not support feedforward chunking'    )
   def     _UpperCAmelCase     (    self    )			->   List[Any]:


        '''simple docstring'''


        pass
   def     _UpperCAmelCase     (    self    )			->   Tuple:


        '''simple docstring'''


        lowercase_			:       int									=			self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
             lowercase_			:       List[Any]									=			model_class(__UpperCamelCase    )
             self.assertIsInstance(model.get_input_embeddings()  ,(nn.Module)    )
             lowercase_			:       int									=			model.get_output_embeddings()
             self.assertTrue(x is None or isinstance(__UpperCamelCase  ,nn.Linear    )    )
   def     _UpperCAmelCase     (    self    )			->   str:


        '''simple docstring'''


        lowercase_			:       str									=			self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
             lowercase_			:       Dict									=			model_class(__UpperCamelCase    )
             lowercase_			:       List[str]									=			inspect.signature(model.forward    )
             # signature.parameters is an OrderedDict => so arg_names order is deterministic
             lowercase_			:       List[Any]									=			[*signature.parameters.keys()]

             lowercase_			:       str									=			['pixel_values']
             self.assertListEqual(arg_names[:1]  ,__UpperCamelCase    )
   @unittest.skip(reason='MaskFormerSwin is only used as backbone and doesn\'t support output_attentions'    )
   def     _UpperCAmelCase     (    self    )			->   Dict:


        '''simple docstring'''


        pass
   @unittest.skip(reason='MaskFormerSwin is only used as an internal backbone'    )
   def     _UpperCAmelCase     (    self    )			->   Tuple:


        '''simple docstring'''


        pass
   def     _UpperCAmelCase     (    self  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )			->   Any:


        '''simple docstring'''


        lowercase_			:       List[Any]									=			model_class(__UpperCamelCase    )
        model.to(__UpperCamelCase    )
        model.eval()

        with torch.no_grad():
             lowercase_			:       Tuple									=			model(**self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase    )    )

        lowercase_			:       Any									=			outputs.hidden_states

        lowercase_			:       Tuple									=			getattr(
            self.model_tester  ,'expected_num_hidden_layers'  ,len(self.model_tester.depths    ) + 1    )
        self.assertEqual(len(__UpperCamelCase    )  ,__UpperCamelCase    )

        # Swin has a different seq_length
        lowercase_			:       List[str]									=			(
            config.patch_size
            if isinstance(config.patch_size  ,collections.abc.Iterable    )
            else (config.patch_size, config.patch_size)
        )

        lowercase_			:       Tuple									=			(image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

        self.assertListEqual(
            list(hidden_states[0].shape[-2:]    )  ,[num_patches, self.model_tester.embed_dim]  ,)
   def     _UpperCAmelCase     (    self    )			->   Optional[int]:


        '''simple docstring'''


        lowercase_			:       Union[str, Any]									=			self.model_tester.prepare_config_and_inputs_for_common()

        lowercase_			:       List[str]									=			(
            self.model_tester.image_size
            if isinstance(self.model_tester.image_size  ,collections.abc.Iterable    )
            else (self.model_tester.image_size, self.model_tester.image_size)
        )

        for model_class in self.all_model_classes:
             lowercase_			:       Dict									=			True
             self.check_hidden_states_output(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )

             # check that output_hidden_states also work using config
             del inputs_dict["output_hidden_states"]
             lowercase_			:       str									=			True

             self.check_hidden_states_output(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        lowercase_			:       str									=			self.model_tester.prepare_config_and_inputs_for_common()
        lowercase_			:       List[str]									=			3

        lowercase_			:       Union[str, Any]									=			(
            self.model_tester.image_size
            if isinstance(self.model_tester.image_size  ,collections.abc.Iterable    )
            else (self.model_tester.image_size, self.model_tester.image_size)
        )
        lowercase_			:       Optional[int]									=			(
            config.patch_size
            if isinstance(config.patch_size  ,collections.abc.Iterable    )
            else (config.patch_size, config.patch_size)
        )

        lowercase_			:       List[Any]									=			image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
        lowercase_			:       Union[str, Any]									=			image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

        for model_class in self.all_model_classes:
             lowercase_			:       List[str]									=			True
             self.check_hidden_states_output(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,(padded_height, padded_width)    )

             # check that output_hidden_states also work using config
             del inputs_dict["output_hidden_states"]
             lowercase_			:       str									=			True
             self.check_hidden_states_output(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,(padded_height, padded_width)    )
   @unittest.skip(reason='MaskFormerSwin doesn\'t have pretrained checkpoints'    )
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        pass
   @unittest.skip(reason='This will be fixed once MaskFormerSwin is replaced by native Swin'    )
   def     _UpperCAmelCase     (    self    )			->   Union[str, Any]:


        '''simple docstring'''


        pass
   @unittest.skip(reason='This will be fixed once MaskFormerSwin is replaced by native Swin'    )
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        pass







   def     _UpperCAmelCase     (    self    )			->   str:


        '''simple docstring'''


        lowercase_			:       List[Any]									=			self.model_tester.prepare_config_and_inputs_for_common()

        def set_nan_tensor_to_zero(__UpperCamelCase    ):
             lowercase_			:       Tuple									=			0
             return t

        def check_equivalence(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase={}    ):
             with torch.no_grad():
                  lowercase_			:       Any									=			model(**__UpperCamelCase  ,return_dict=__UpperCamelCase  ,**__UpperCamelCase    )
                  lowercase_			:       Any									=			model(**__UpperCamelCase  ,return_dict=__UpperCamelCase  ,**__UpperCamelCase    ).to_tuple()

                  def recursive_check(__UpperCamelCase  ,__UpperCamelCase    ):
                       if isinstance(__UpperCamelCase  ,(List, Tuple)    ):
                            for tuple_iterable_value, dict_iterable_value in zip(__UpperCamelCase  ,__UpperCamelCase    ):
                                 recursive_check(__UpperCamelCase  ,__UpperCamelCase    )
                       elif isinstance(__UpperCamelCase  ,__UpperCamelCase    ):
                            for tuple_iterable_value, dict_iterable_value in zip(
                                tuple_object.values()  ,dict_object.values()    ):
                                 recursive_check(__UpperCamelCase  ,__UpperCamelCase    )
                       elif tuple_object is None:
                            return
                       else:
                            self.assertTrue(
                                torch.allclose(
                                    set_nan_tensor_to_zero(__UpperCamelCase    )  ,set_nan_tensor_to_zero(__UpperCamelCase    )  ,atol=1e-5    )  ,msg=(
                                    'Tuple and dict output are not equal. Difference:'
                                    f''' {torch.max(torch.abs(tuple_object - dict_object    )    )}. Tuple has `nan`:'''
                                    f''' {torch.isnan(__UpperCamelCase    ).any()} and `inf`: {torch.isinf(__UpperCamelCase    )}. Dict has'''
                                    f''' `nan`: {torch.isnan(__UpperCamelCase    ).any()} and `inf`: {torch.isinf(__UpperCamelCase    )}.'''
                                )  ,)

                  recursive_check(__UpperCamelCase  ,__UpperCamelCase    )

        for model_class in self.all_model_classes:
             lowercase_			:       str									=			model_class(__UpperCamelCase    )
             model.to(__UpperCamelCase    )
             model.eval()

             lowercase_			:       Optional[int]									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase    )
             lowercase_			:       Any									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase    )
             check_equivalence(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )

             lowercase_			:       Tuple									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase  ,return_labels=__UpperCamelCase    )
             lowercase_			:       Union[str, Any]									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase  ,return_labels=__UpperCamelCase    )
             check_equivalence(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )

             lowercase_			:       Optional[Any]									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase    )
             lowercase_			:       str									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase    )
             check_equivalence(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,{'output_hidden_states': True}    )

             lowercase_			:       Tuple									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase  ,return_labels=__UpperCamelCase    )
             lowercase_			:       Optional[Any]									=			self._prepare_for_class(__UpperCamelCase  ,__UpperCamelCase  ,return_labels=__UpperCamelCase    )
             check_equivalence(__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase  ,{'output_hidden_states': True}    )







@require_torch
class  UpperCamelCase	(    unittest.TestCase		,   lowercase_						):
   lowercase							=						(MaskFormerSwinBackbone,) if is_torch_available() else ()
   lowercase							=						MaskFormerSwinConfig
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        lowercase_			:       List[str]									=			MaskFormerSwinModelTester(self    )







   def     _UpperCAmelCase     (    self    )			->   Any:


        '''simple docstring'''


        lowercase_			:       Tuple									=			self.model_tester.prepare_config_and_inputs_for_common()
        lowercase_			:       Union[str, Any]									=			inputs_dict['pixel_values'].shape[0]

        for backbone_class in self.all_model_classes:
             lowercase_			:       Any									=			backbone_class(__UpperCamelCase    )
             backbone.to(__UpperCamelCase    )
             backbone.eval()

             lowercase_			:       Any									=			backbone(**__UpperCamelCase    )

             # Test default outputs and verify feature maps
             self.assertIsInstance(outputs.feature_maps  ,__UpperCamelCase    )
             self.assertTrue(len(outputs.feature_maps    ) == len(backbone.channels    )    )
             for feature_map, n_channels in zip(outputs.feature_maps  ,backbone.channels    ):
                  self.assertTrue(feature_map.shape[:2]  ,(batch_size, n_channels)    )
             self.assertIsNone(outputs.hidden_states    )
             self.assertIsNone(outputs.attentions    )

             # Test output_hidden_states=True
             lowercase_			:       Dict									=			backbone(**__UpperCamelCase  ,output_hidden_states=__UpperCamelCase    )
             self.assertIsNotNone(outputs.hidden_states    )
             self.assertTrue(len(outputs.hidden_states    )  ,len(backbone.stage_names    )    )
             # We skip the stem layer
             for hidden_states, n_channels in zip(outputs.hidden_states[1:]  ,backbone.channels    ):
                  for hidden_state in hidden_states:
                       # Hidden states are in the format (batch_size, (height * width), n_channels)
                       lowercase_			:       Optional[int]									=			hidden_state.shape
                       self.assertTrue((h_batch_size, h_n_channels)  ,(batch_size, n_channels)    )

            # Test output_attentions=True
             if self.has_attentions:
                  lowercase_			:       List[Any]									=			backbone(**__UpperCamelCase  ,output_attentions=__UpperCamelCase    )
                  self.assertIsNotNone(outputs.attentions    )


"""simple docstring"""







import random
import unittest

import torch

from diffusers import IFImgaImgSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device

from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin







@skip_mps
class  UpperCamelCase	(    lowercase_		,   lowercase_		,   unittest.TestCase						):
   lowercase							=						IFImgaImgSuperResolutionPipeline
   lowercase							=						TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {'width', 'height'}
   lowercase							=						TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS.union({'original_image'}						)
   lowercase							=						PipelineTesterMixin.required_optional_params - {'latents'}
   def     _UpperCAmelCase     (    self    )			->   int:


        '''simple docstring'''


        return self._get_superresolution_dummy_components()
   def     _UpperCAmelCase     (    self  ,__UpperCamelCase  ,__UpperCamelCase=0    )			->   List[str]:


        '''simple docstring'''


        if str(__UpperCamelCase    ).startswith('mps'    ):
             lowercase_			:       Any									=			torch.manual_seed(__UpperCamelCase    )
        else:
             lowercase_			:       int									=			torch.Generator(device=__UpperCamelCase    ).manual_seed(__UpperCamelCase    )

        lowercase_			:       Optional[int]									=			floats_tensor((1, 3, 32, 32)  ,rng=random.Random(__UpperCamelCase    )    ).to(__UpperCamelCase    )
        lowercase_			:       List[str]									=			floats_tensor((1, 3, 16, 16)  ,rng=random.Random(__UpperCamelCase    )    ).to(__UpperCamelCase    )

        lowercase_			:       Optional[Any]									=			{
            'prompt': 'A painting of a squirrel eating a burger',
            'image': image,
            'original_image': original_image,
            'generator': generator,
            'num_inference_steps': 2,
            'output_type': 'numpy',
        }

        return inputs
   @unittest.skipIf(
       torch_device != 'cuda' or not is_xformers_available()  ,reason='XFormers attention is only available with CUDA and `xformers` installed'  ,)
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3    )
   def     _UpperCAmelCase     (    self    )			->   Dict:


        '''simple docstring'''


        self._test_save_load_optional_components()
   @unittest.skipIf(torch_device != 'cuda'  ,reason='float16 requires CUDA'    )
   def     _UpperCAmelCase     (    self    )			->   Optional[int]:


        '''simple docstring'''


        super().test_save_load_floataa(expected_max_diff=1e-1    )
   def     _UpperCAmelCase     (    self    )			->   Dict:


        '''simple docstring'''


        self._test_attention_slicing_forward_pass(expected_max_diff=1e-2    )
   def     _UpperCAmelCase     (    self    )			->   List[Any]:


        '''simple docstring'''


        self._test_save_load_local()







   def     _UpperCAmelCase     (    self    )			->   List[Any]:


        '''simple docstring'''


        self._test_inference_batch_single_identical(
            expected_max_diff=1e-2  ,)

