


import copy
import inspect
import unittest

from transformers import AutoBackbone
from transformers.configuration_utils import PretrainedConfig
from transformers.testing_utils import require_timm, require_torch, torch_device
from transformers.utils.import_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


if is_torch_available():
 import torch

 from transformers import TimmBackbone, TimmBackboneConfig

from ...test_pipeline_mixin import PipelineTesterMixin






class _lowerCamelCase:
       def __init__(      self,   lowerCamelCase,   lowerCamelCase=None,   lowerCamelCase=None,   lowerCamelCase=None,   lowerCamelCase="resnet50",   lowerCamelCase=3,   lowerCamelCase=32,   lowerCamelCase=3,   lowerCamelCase=True,   lowerCamelCase=True,   ) ->     Optional[Any]:




           """simple docstring"""

           _lowercase :							str   	=	parent
           _lowercase :							Tuple   	=	out_indices if out_indices is not None else [4]
           _lowercase :							List[str]   	=	stage_names
           _lowercase :							List[Any]   	=	out_features
           _lowercase :							List[str]   	=	backbone
           _lowercase :							int   	=	batch_size
           _lowercase :							Optional[int]   	=	image_size
           _lowercase :							int   	=	num_channels
           _lowercase :							Optional[Any]   	=	use_pretrained_backbone
           _lowercase :							str   	=	is_training
       def     UpperCamelCase  (      self) ->     Tuple:




           """simple docstring"""

           _lowercase :							Any   	=	floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])
           _lowercase :							int   	=	self.get_config()

           return config, pixel_values
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           return TimmBackboneConfig(
               image_size=self.image_size,   num_channels=self.num_channels,   out_features=self.out_features,   out_indices=self.out_indices,   stage_names=self.stage_names,   use_pretrained_backbone=self.use_pretrained_backbone,   backbone=self.backbone,   )
       def     UpperCamelCase  (      self,   lowerCamelCase,   lowerCamelCase) ->     Tuple:




           """simple docstring"""

           _lowercase :							Union[str, Any]   	=	TimmBackbone(config=lowerCamelCase)
           model.to(lowerCamelCase)
           model.eval()
           with torch.no_grad():
               _lowercase :							Optional[int]   	=	model(lowerCamelCase)
           self.parent.assertEqual(
               result.feature_map[-1].shape,   (self.batch_size, model.channels[-1], 14, 14),   )




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




           """simple docstring"""

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






@require_torch
@require_timm
class _lowerCamelCase(		_a,				_a,				_a,				unittest.TestCase     ):
       lowercase_				:			str									=    (TimmBackbone,) if is_torch_available() else ()
       lowercase_				:			Union[str, Any]									=    {"""feature-extraction""": TimmBackbone} if is_torch_available() else {}
       lowercase_				:			List[Any]									=    False
       lowercase_				:			Optional[Any]									=    False
       lowercase_				:			int									=    False
       lowercase_				:			str									=    False
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           _lowercase :							Union[str, Any]   	=	TimmBackboneModelTester(self)
           _lowercase :							List[str]   	=	ConfigTester(self,   config_class=lowerCamelCase,   has_text_modality=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           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) ->     List[str]:




           """simple docstring"""

           _lowercase :							List[Any]   	=	'resnet18'
           _lowercase :							Any   	=	'microsoft/resnet-18'

           _lowercase :							Union[str, Any]   	=	AutoBackbone.from_pretrained(lowerCamelCase,   use_timm_backbone=lowerCamelCase)
           _lowercase :							Any   	=	AutoBackbone.from_pretrained(lowerCamelCase)

           self.assertEqual(len(timm_model.out_features),   len(transformers_model.out_features))
           self.assertEqual(len(timm_model.stage_names),   len(transformers_model.stage_names))
           self.assertEqual(timm_model.channels,   transformers_model.channels)
           # Out indices are set to the last layer by default. For timm models, we don't know
           # the number of layers in advance, so we set it to (-1,), whereas for transformers
           # models, we set it to [len(stage_names) - 1] (kept for backward compatibility).
           self.assertEqual(timm_model.out_indices,   (-1,))
           self.assertEqual(transformers_model.out_indices,   [len(timm_model.stage_names) - 1])

           _lowercase :							List[Any]   	=	AutoBackbone.from_pretrained(lowerCamelCase,   use_timm_backbone=lowerCamelCase,   out_indices=[1, 2, 3])
           _lowercase :							Tuple   	=	AutoBackbone.from_pretrained(lowerCamelCase,   out_indices=[1, 2, 3])

           self.assertEqual(timm_model.out_indices,   transformers_model.out_indices)
           self.assertEqual(len(timm_model.out_features),   len(transformers_model.out_features))
           self.assertEqual(timm_model.channels,   transformers_model.channels)
       @unittest.skip('TimmBackbone doesn\'t support feed forward chunking')
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           pass
       @unittest.skip('TimmBackbone doesn\'t have num_hidden_layers attribute')
       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           pass
       @unittest.skip('TimmBackbone initialization is managed on the timm side')
       def     UpperCamelCase  (      self) ->     Tuple:




           """simple docstring"""

           pass
       @unittest.skip('TimmBackbone models doesn\'t have inputs_embeds')
       def     UpperCamelCase  (      self) ->     Any:




           """simple docstring"""

           pass
       @unittest.skip('TimmBackbone models doesn\'t have inputs_embeds')
       def     UpperCamelCase  (      self) ->     List[Any]:




           """simple docstring"""

           pass
       @unittest.skip('TimmBackbone model cannot be created without specifying a backbone checkpoint')
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           pass
       @unittest.skip('Only checkpoints on timm can be loaded into TimmBackbone')
       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           pass
       @unittest.skip('model weights aren\'t tied in TimmBackbone.')
       def     UpperCamelCase  (      self) ->     Union[str, Any]:




           """simple docstring"""

           pass
       @unittest.skip('model weights aren\'t tied in TimmBackbone.')
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           pass
       @unittest.skip('Only checkpoints on timm can be loaded into TimmBackbone')
       def     UpperCamelCase  (      self) ->     List[Any]:




           """simple docstring"""

           pass
       @unittest.skip('Only checkpoints on timm can be loaded into TimmBackbone')
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           pass
       @unittest.skip('TimmBackbone doesn\'t have hidden size info in its configuration.')
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           pass
       @unittest.skip('TimmBackbone doesn\'t support output_attentions.')
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           pass
       @unittest.skip('Safetensors is not supported by timm.')
       def     UpperCamelCase  (      self) ->     Dict:




           """simple docstring"""

           pass
       @unittest.skip('Will be fixed soon by reducing the size of the model used for common tests.')
       def     UpperCamelCase  (      self) ->     List[Any]:




           """simple docstring"""

           pass
       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           _lowercase	,       _lowercase :							Any   	=	self.model_tester.prepare_config_and_inputs_for_common()

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

               _lowercase :							List[str]   	=	['pixel_values']
               self.assertListEqual(arg_names[:1],   lowerCamelCase)
       def     UpperCamelCase  (      self) ->     Optional[Any]:




           """simple docstring"""

           _lowercase	,       _lowercase :							List[Any]   	=	self.model_tester.prepare_config_and_inputs_for_common()
           _lowercase :							List[Any]   	=	True
           _lowercase :							Union[str, Any]   	=	self.has_attentions

           # no need to test all models as different heads yield the same functionality
           _lowercase :							str   	=	self.all_model_classes[0]
           _lowercase :							Tuple   	=	model_class(lowerCamelCase)
           model.to(lowerCamelCase)

           _lowercase :							int   	=	self._prepare_for_class(lowerCamelCase,   lowerCamelCase)
           _lowercase :							str   	=	model(**lowerCamelCase)
           _lowercase :							Optional[Any]   	=	outputs[0][-1]

           # Encoder-/Decoder-only models
           _lowercase :							Optional[Any]   	=	outputs.hidden_states[0]
           hidden_states.retain_grad()

           if self.has_attentions:
               _lowercase :							List[str]   	=	outputs.attentions[0]
               attentions.retain_grad()

           output.flatten()[0].backward(retain_graph=lowerCamelCase)

           self.assertIsNotNone(hidden_states.grad)

           if self.has_attentions:
               self.assertIsNotNone(attentions.grad)




       def     UpperCamelCase  (      self) ->     Dict:




           """simple docstring"""

           _lowercase	,       _lowercase :							Dict   	=	self.model_tester.prepare_config_and_inputs_for_common()

           for model_class in self.all_model_classes:
               _lowercase :							Optional[Any]   	=	model_class(lowerCamelCase)
               model.to(lowerCamelCase)
               model.eval()
               _lowercase :							str   	=	model(**lowerCamelCase)

               self.assertEqual(len(result.feature_maps),   len(config.out_indices))
               self.assertEqual(len(model.channels),   len(config.out_indices))

               # Check output of last stage is taken if out_features=None, out_indices=None
               _lowercase :							Tuple   	=	copy.deepcopy(lowerCamelCase)
               _lowercase :							str   	=	None
               _lowercase :							Union[str, Any]   	=	model_class(lowerCamelCase)
               model.to(lowerCamelCase)
               model.eval()
               _lowercase :							int   	=	model(**lowerCamelCase)

               self.assertEqual(len(result.feature_maps),   1)
               self.assertEqual(len(model.channels),   1)

               # Check backbone can be initialized with fresh weights
               _lowercase :							Union[str, Any]   	=	copy.deepcopy(lowerCamelCase)
               _lowercase :							List[str]   	=	False
               _lowercase :							Optional[Any]   	=	model_class(lowerCamelCase)
               model.to(lowerCamelCase)
               model.eval()
               _lowercase :							Any   	=	model(**lowerCamelCase)






import unittest

from diffusers.models.unet_ad_blocks import *  # noqa F403
from diffusers.utils import torch_device

from .test_unet_blocks_common import UNetBlockTesterMixin






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			str									=    DownBlockaD  # noqa F405
       lowercase_				:			List[str]									=    """down"""
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           _lowercase :							str   	=	[-0.0_2_3_2, -0.9_8_6_9, 0.8_0_5_4, -0.0_6_3_7, -0.1_6_8_8, -1.4_2_6_4, 0.4_4_7_0, -1.3_3_9_4, 0.0_9_0_4]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			Optional[Any]									=    ResnetDownsampleBlockaD  # noqa F405
       lowercase_				:			Optional[Any]									=    """down"""
       def     UpperCamelCase  (      self) ->     Any:




           """simple docstring"""

           _lowercase :							Optional[Any]   	=	[0.0_7_1_0, 0.2_4_1_0, -0.7_3_2_0, -1.0_7_5_7, -1.1_3_4_3, 0.3_5_4_0, -0.0_1_3_3, -0.2_5_7_6, 0.0_9_4_8]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			Any									=    AttnDownBlockaD  # noqa F405
       lowercase_				:			Dict									=    """down"""
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           _lowercase :							Optional[int]   	=	[0.0_6_3_6, 0.8_9_6_4, -0.6_2_3_4, -1.0_1_3_1, 0.0_8_4_4, 0.4_9_3_5, 0.3_4_3_7, 0.0_9_1_1, -0.2_9_5_7]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			str									=    CrossAttnDownBlockaD  # noqa F405
       lowercase_				:			Optional[int]									=    """down"""
       def     UpperCamelCase  (      self) ->     Dict:




           """simple docstring"""

           _lowercase	,       _lowercase :							int   	=	super().prepare_init_args_and_inputs_for_common()
           _lowercase :							int   	=	32
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           _lowercase :							List[str]   	=	[0.2_2_3_8, -0.7_3_9_6, -0.2_2_5_5, -0.3_8_2_9, 0.1_9_2_5, 1.1_6_6_5, 0.0_6_0_3, -0.7_2_9_5, 0.1_9_8_3]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			Dict									=    SimpleCrossAttnDownBlockaD  # noqa F405
       lowercase_				:			Optional[Any]									=    """down"""
       @property
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           return super().get_dummy_input(include_encoder_hidden_states=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     List[Any]:




           """simple docstring"""

           _lowercase	,       _lowercase :							Dict   	=	super().prepare_init_args_and_inputs_for_common()
           _lowercase :							Optional[Any]   	=	32
           return init_dict, inputs_dict




       @unittest.skipIf(torch_device == 'mps',   'MPS result is not consistent')
       def     UpperCamelCase  (      self) ->     int:




           """simple docstring"""

           _lowercase :							Tuple   	=	[0.7_9_2_1, -0.0_9_9_2, -0.1_9_6_2, -0.7_6_9_5, -0.4_2_4_2, 0.7_8_0_4, 0.4_7_3_7, 0.2_7_6_5, 0.3_3_3_8]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			str									=    SkipDownBlockaD  # noqa F405
       lowercase_				:			Union[str, Any]									=    """down"""
       @property
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           return super().get_dummy_input(include_skip_sample=lowerCamelCase)




       def     UpperCamelCase  (      self) ->     Tuple:




           """simple docstring"""

           _lowercase :							int   	=	[-0.0_8_4_5, -0.2_0_8_7, -0.2_4_6_5, 0.0_9_7_1, 0.1_9_0_0, -0.0_4_8_4, 0.2_6_6_4, 0.4_1_7_9, 0.5_0_6_9]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			str									=    AttnSkipDownBlockaD  # noqa F405
       lowercase_				:			Optional[Any]									=    """down"""
       @property
       def     UpperCamelCase  (      self) ->     Tuple:




           """simple docstring"""

           return super().get_dummy_input(include_skip_sample=lowerCamelCase)




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




           """simple docstring"""

           _lowercase :							Optional[int]   	=	[0.5_5_3_9, 0.1_6_0_9, 0.4_9_2_4, 0.0_5_3_7, -0.1_9_9_5, 0.4_0_5_0, 0.0_9_7_9, -0.2_7_2_1, -0.0_6_4_2]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			str									=    DownEncoderBlockaD  # noqa F405
       lowercase_				:			Optional[Any]									=    """down"""
       @property
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           return super().get_dummy_input(include_temb=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     int:




           """simple docstring"""

           _lowercase :							Dict   	=	{
               'in_channels': 32,
               'out_channels': 32,
           }
           _lowercase :							int   	=	self.dummy_input
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           _lowercase :							List[str]   	=	[1.1_1_0_2, 0.5_3_0_2, 0.4_8_7_2, -0.0_0_2_3, -0.8_0_4_2, 0.0_4_8_3, -0.3_4_8_9, -0.5_6_3_2, 0.7_6_2_6]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			int									=    AttnDownEncoderBlockaD  # noqa F405
       lowercase_				:			Tuple									=    """down"""
       @property
       def     UpperCamelCase  (      self) ->     Tuple:




           """simple docstring"""

           return super().get_dummy_input(include_temb=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           _lowercase :							Any   	=	{
               'in_channels': 32,
               'out_channels': 32,
           }
           _lowercase :							Optional[int]   	=	self.dummy_input
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     Optional[Any]:




           """simple docstring"""

           _lowercase :							Union[str, Any]   	=	[0.8_9_6_6, -0.1_4_8_6, 0.8_5_6_8, 0.8_1_4_1, -0.9_0_4_6, -0.1_3_4_2, -0.0_9_7_2, -0.7_4_1_7, 0.1_5_3_8]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			int									=    UNetMidBlockaD  # noqa F405
       lowercase_				:			Optional[int]									=    """mid"""
       def     UpperCamelCase  (      self) ->     Optional[Any]:




           """simple docstring"""

           _lowercase :							int   	=	{
               'in_channels': 32,
               'temb_channels': 1_28,
           }
           _lowercase :							Optional[Any]   	=	self.dummy_input
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     Dict:




           """simple docstring"""

           _lowercase :							Dict   	=	[-0.1_0_6_2, 1.7_2_4_8, 0.3_4_9_4, 1.4_5_6_9, -0.0_9_1_0, -1.2_4_2_1, -0.9_9_8_4, 0.6_7_3_6, 1.0_0_2_8]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			Dict									=    UNetMidBlockaDCrossAttn  # noqa F405
       lowercase_				:			Dict									=    """mid"""
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           _lowercase	,       _lowercase :							Union[str, Any]   	=	super().prepare_init_args_and_inputs_for_common()
           _lowercase :							Any   	=	32
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           _lowercase :							Dict   	=	[0.0_1_8_7, 2.4_2_2_0, 0.4_4_8_4, 1.1_2_0_3, -0.6_1_2_1, -1.5_1_2_2, -0.8_2_7_0, 0.7_8_5_1, 1.8_3_3_5]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			List[Any]									=    UNetMidBlockaDSimpleCrossAttn  # noqa F405
       lowercase_				:			Any									=    """mid"""
       @property
       def     UpperCamelCase  (      self) ->     Union[str, Any]:




           """simple docstring"""

           return super().get_dummy_input(include_encoder_hidden_states=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     Dict:




           """simple docstring"""

           _lowercase	,       _lowercase :							str   	=	super().prepare_init_args_and_inputs_for_common()
           _lowercase :							List[str]   	=	32
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           _lowercase :							int   	=	[0.7_1_4_3, 1.9_9_7_4, 0.5_4_4_8, 1.3_9_7_7, 0.1_2_8_2, -1.1_2_3_7, -1.4_2_3_8, 0.5_5_3_0, 0.8_8_8_0]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			List[Any]									=    UpBlockaD  # noqa F405
       lowercase_				:			List[str]									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     List[Any]:




           """simple docstring"""

           return super().get_dummy_input(include_res_hidden_states_tuple=lowerCamelCase)




       def     UpperCamelCase  (      self) ->     Dict:




           """simple docstring"""

           _lowercase :							Any   	=	[-0.2_0_4_1, -0.4_1_6_5, -0.3_0_2_2, 0.0_0_4_1, -0.6_6_2_8, -0.7_0_5_3, 0.1_9_2_8, -0.0_3_2_5, 0.0_5_2_3]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			List[str]									=    ResnetUpsampleBlockaD  # noqa F405
       lowercase_				:			Optional[int]									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           return super().get_dummy_input(include_res_hidden_states_tuple=lowerCamelCase)




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




           """simple docstring"""

           _lowercase :							List[Any]   	=	[0.2_2_8_7, 0.3_5_4_9, -0.1_3_4_6, 0.4_7_9_7, -0.1_7_1_5, -0.9_6_4_9, 0.7_3_0_5, -0.5_8_6_4, -0.6_2_4_4]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			Dict									=    CrossAttnUpBlockaD  # noqa F405
       lowercase_				:			List[str]									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     int:




           """simple docstring"""

           return super().get_dummy_input(include_res_hidden_states_tuple=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     Union[str, Any]:




           """simple docstring"""

           _lowercase	,       _lowercase :							Union[str, Any]   	=	super().prepare_init_args_and_inputs_for_common()
           _lowercase :							Tuple   	=	32
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           _lowercase :							Dict   	=	[-0.1_4_0_3, -0.3_5_1_5, -0.0_4_2_0, -0.1_4_2_5, 0.3_1_6_7, 0.5_0_9_4, -0.2_1_8_1, 0.5_9_3_1, 0.5_5_8_2]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			Optional[int]									=    SimpleCrossAttnUpBlockaD  # noqa F405
       lowercase_				:			List[Any]									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     Any:




           """simple docstring"""

           return super().get_dummy_input(include_res_hidden_states_tuple=lowerCamelCase,   include_encoder_hidden_states=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           _lowercase	,       _lowercase :							int   	=	super().prepare_init_args_and_inputs_for_common()
           _lowercase :							Dict   	=	32
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     Dict:




           """simple docstring"""

           _lowercase :							List[str]   	=	[0.2_6_4_5, 0.1_4_8_0, 0.0_9_0_9, 0.8_0_4_4, -0.9_7_5_8, -0.9_0_8_3, 0.0_9_9_4, -1.1_4_5_3, -0.7_4_0_2]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			List[str]									=    AttnUpBlockaD  # noqa F405
       lowercase_				:			Optional[int]									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           return super().get_dummy_input(include_res_hidden_states_tuple=lowerCamelCase)




       @unittest.skipIf(torch_device == 'mps',   'MPS result is not consistent')
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           _lowercase :							Union[str, Any]   	=	[0.0_9_7_9, 0.1_3_2_6, 0.0_0_2_1, 0.0_6_5_9, 0.2_2_4_9, 0.0_0_5_9, 0.1_1_3_2, 0.5_9_5_2, 0.1_0_3_3]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			List[str]									=    SkipUpBlockaD  # noqa F405
       lowercase_				:			Optional[Any]									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     List[str]:




           """simple docstring"""

           return super().get_dummy_input(include_res_hidden_states_tuple=lowerCamelCase)




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




           """simple docstring"""

           _lowercase :							Optional[Any]   	=	[-0.0_8_9_3, -0.1_2_3_4, -0.1_5_0_6, -0.0_3_3_2, 0.0_1_2_3, -0.0_2_1_1, 0.0_5_6_6, 0.0_1_4_3, 0.0_3_6_2]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			int									=    AttnSkipUpBlockaD  # noqa F405
       lowercase_				:			Any									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     int:




           """simple docstring"""

           return super().get_dummy_input(include_res_hidden_states_tuple=lowerCamelCase)




       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           _lowercase :							Tuple   	=	[0.0_3_6_1, 0.0_6_1_7, 0.2_7_8_7, -0.0_3_5_0, 0.0_3_4_2, 0.3_4_2_1, -0.0_8_4_3, 0.0_9_1_3, 0.3_0_1_5]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			List[str]									=    UpDecoderBlockaD  # noqa F405
       lowercase_				:			int									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     List[Any]:




           """simple docstring"""

           return super().get_dummy_input(include_temb=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     Optional[int]:




           """simple docstring"""

           _lowercase :							Optional[Any]   	=	{'in_channels': 32, 'out_channels': 32}

           _lowercase :							Optional[Any]   	=	self.dummy_input
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     int:




           """simple docstring"""

           _lowercase :							List[Any]   	=	[0.4_4_0_4, 0.1_9_9_8, -0.9_8_8_6, -0.3_3_2_0, -0.3_1_2_8, -0.7_0_3_4, -0.6_9_5_5, -0.2_3_3_8, -0.3_1_3_7]
           super().test_output(lowerCamelCase)






class _lowerCamelCase(		_a,				unittest.TestCase     ):
       lowercase_				:			Any									=    AttnUpDecoderBlockaD  # noqa F405
       lowercase_				:			str									=    """up"""
       @property
       def     UpperCamelCase  (      self) ->     int:




           """simple docstring"""

           return super().get_dummy_input(include_temb=lowerCamelCase)
       def     UpperCamelCase  (      self) ->     Any:




           """simple docstring"""

           _lowercase :							Optional[Any]   	=	{'in_channels': 32, 'out_channels': 32}

           _lowercase :							List[Any]   	=	self.dummy_input
           return init_dict, inputs_dict




       def     UpperCamelCase  (      self) ->     str:




           """simple docstring"""

           _lowercase :							Optional[int]   	=	[0.6_7_3_8, 0.4_4_9_1, 0.1_0_5_5, 1.0_7_1_0, 0.7_3_1_6, 0.3_3_3_9, 0.3_3_5_2, 0.1_0_2_3, 0.3_5_6_8]
           super().test_output(lowerCamelCase)


