


import argparse
import os
import re


SCREAMING_SNAKE_CASE						:Dict			=  '''src/transformers'''

# Pattern that looks at the indentation in a line.
SCREAMING_SNAKE_CASE						:str			=  re.compile(R'''^(\s*)\S''')
# Pattern that matches `"key":" and puts `key` in group 0.
SCREAMING_SNAKE_CASE						:int			=  re.compile(R'''^\s*"([^"]+)":''')
# Pattern that matches `_import_structure["key"]` and puts `key` in group 0.
SCREAMING_SNAKE_CASE						:List[str]			=  re.compile(R'''^\s*_import_structure\["([^"]+)"\]''')
# Pattern that matches `"key",` and puts `key` in group 0.
SCREAMING_SNAKE_CASE						:int			=  re.compile(R'''^\s*"([^"]+)",\s*$''')
# Pattern that matches any `[stuff]` and puts `stuff` in group 0.
SCREAMING_SNAKE_CASE						:Optional[Any]			=  re.compile(R'''\[([^\]]+)\]''')



def       _lowerCAmelCase    (				lowerCAmelCase_				:Any				)->Optional[Any]:
   '''simple docstring'''






   snake_case_            =       _re_indent.search(lowerCAmelCase_				)
   return "" if search is None else search.groups()[0]



def       _lowerCAmelCase    (				lowerCAmelCase_				:Any		,    lowerCAmelCase_				:Dict=""		,    lowerCAmelCase_				:Any=None		,    lowerCAmelCase_				:Tuple=None				)->Dict:
   '''simple docstring'''






   snake_case_            =       0
   snake_case_            =       code.split("\n"				)
   if start_prompt is not None:
      while not lines[index].startswith(lowerCAmelCase_				):
         index += 1
      snake_case_            =       ["\n".join(lines[:index]				)]
   else:
      snake_case_            =       []

   # We split into blocks until we get to the `end_prompt` (or the end of the block).
   snake_case_            =       [lines[index]]
   index += 1
   while index < len(lowerCAmelCase_				) and (end_prompt is None or not lines[index].startswith(lowerCAmelCase_				)):
      if len(lines[index]				) > 0 and get_indent(lines[index]				) == indent_level:
         if len(lowerCAmelCase_				) > 0 and get_indent(current_block[-1]				).startswith(indent_level + " "				):
            current_block.append(lines[index]				)
            blocks.append("\n".join(lowerCAmelCase_				)				)
            if index < len(lowerCAmelCase_				) - 1:
               snake_case_            =       [lines[index + 1]]
               index += 1
            else:
               snake_case_            =       []
         else:
            blocks.append("\n".join(lowerCAmelCase_				)				)
            snake_case_            =       [lines[index]]
      else:
         current_block.append(lines[index]				)
      index += 1

   # Adds current block if it's nonempty.
   if len(lowerCAmelCase_				) > 0:
      blocks.append("\n".join(lowerCAmelCase_				)				)

   # Add final block after end_prompt if provided.
   if end_prompt is not None and index < len(lowerCAmelCase_				):
      blocks.append("\n".join(lines[index:]				)				)

   return blocks



def       _lowerCAmelCase    (				lowerCAmelCase_				:int				)->int:
   '''simple docstring'''






   def _inner(lowerCAmelCase_				:Dict				):
      return key(lowerCAmelCase_				).lower().replace("_"		,    ""				)

   return _inner



def       _lowerCAmelCase    (				lowerCAmelCase_				:Tuple		,    lowerCAmelCase_				:Tuple=None				)->int:
   '''simple docstring'''






   def noop(lowerCAmelCase_				:int				):
      return x

   if key is None:
      snake_case_            =       noop
   # Constants are all uppercase, they go first.
   snake_case_            =       [obj for obj in objects if key(lowerCAmelCase_				).isupper()]
   # Classes are not all uppercase but start with a capital, they go second.
   snake_case_            =       [obj for obj in objects if key(lowerCAmelCase_				)[0].isupper() and not key(lowerCAmelCase_				).isupper()]
   # Functions begin with a lowercase, they go last.
   snake_case_            =       [obj for obj in objects if not key(lowerCAmelCase_				)[0].isupper()]

   snake_case_            =       ignore_underscore(lowerCAmelCase_				)
   return sorted(lowerCAmelCase_		,    key=lowerCAmelCase_				) + sorted(lowerCAmelCase_		,    key=lowerCAmelCase_				) + sorted(lowerCAmelCase_		,    key=lowerCAmelCase_				)



def       _lowerCAmelCase    (				lowerCAmelCase_				:Optional[int]				)->Tuple:
   '''simple docstring'''






   def _replace(lowerCAmelCase_				:Dict				):
      snake_case_            =       match.groups()[0]
      if "," not in imports:
         return F'''[{imports}]'''
      snake_case_            =       [part.strip().replace("\""		,    ""				) for part in imports.split(","				)]
      # We will have a final empty element if the line finished with a comma.
      if len(keys[-1]				) == 0:
         snake_case_            =       keys[:-1]
      return "[" + ", ".join([F'''"{k}"''' for k in sort_objects(lowerCAmelCase_				)]				) + "]"

   snake_case_            =       import_statement.split("\n"				)
   if len(lowerCAmelCase_				) > 3:
      # Here we have to sort internal imports that are on several lines (one per name):
      # key: [
      #     "object1",
      #     "object2",
      #     ...
      # ]

      # We may have to ignore one or two lines on each side.
      snake_case_            =       2 if lines[1].strip() == "[" else 1
      snake_case_            =       [(i, _re_strip_line.search(lowerCAmelCase_				).groups()[0]) for i, line in enumerate(lines[idx:-idx]				)]
      snake_case_            =       sort_objects(lowerCAmelCase_		,    key=lambda lowerCAmelCase_				: x[1]				)
      snake_case_            =       [lines[x[0] + idx] for x in sorted_indices]
      return "\n".join(lines[:idx] + sorted_lines + lines[-idx:]				)
   elif len(lowerCAmelCase_				) == 3:
      # Here we have to sort internal imports that are on one separate line:
      # key: [
      #     "object1", "object2", ...
      # ]
      if _re_bracket_content.search(lines[1]				) is not None:
         snake_case_            =       _re_bracket_content.sub(_replace		,    lines[1]				)
      else:
         snake_case_            =       [part.strip().replace("\""		,    ""				) for part in lines[1].split(","				)]
         # We will have a final empty element if the line finished with a comma.
         if len(keys[-1]				) == 0:
            snake_case_            =       keys[:-1]
         snake_case_            =       get_indent(lines[1]				) + ", ".join([F'''"{k}"''' for k in sort_objects(lowerCAmelCase_				)]				)
      return "\n".join(lowerCAmelCase_				)
   else:
      # Finally we have to deal with imports fitting on one line
      snake_case_            =       _re_bracket_content.sub(_replace		,    lowerCAmelCase_				)
      return import_statement



def       _lowerCAmelCase    (				lowerCAmelCase_				:Optional[Any]		,    lowerCAmelCase_				:List[str]=True				)->Union[str, Any]:
   '''simple docstring'''






   with open(lowerCAmelCase_		,    encoding="utf-8"				) as f:
      snake_case_            =       f.read()

   if "_import_structure" not in code:
      return

   # Blocks of indent level 0
   snake_case_            =       split_code_in_indented_blocks(
       lowerCAmelCase_		,    start_prompt="_import_structure = {"		,    end_prompt="if TYPE_CHECKING:"				)

   # We ignore block 0 (everything untils start_prompt) and the last block (everything after end_prompt).
   for block_idx in range(1		,    len(lowerCAmelCase_				) - 1				):
      # Check if the block contains some `_import_structure`s thingy to sort.
      snake_case_            =       main_blocks[block_idx]
      snake_case_            =       block.split("\n"				)

      # Get to the start of the imports.
      snake_case_            =       0
      while line_idx < len(lowerCAmelCase_				) and "_import_structure" not in block_lines[line_idx]:
         # Skip dummy import blocks
         if "import dummy" in block_lines[line_idx]:
            snake_case_            =       len(lowerCAmelCase_				)
         else:
            line_idx += 1
      if line_idx >= len(lowerCAmelCase_				):
         continue

      # Ignore beginning and last line: they don't contain anything.
      snake_case_            =       "\n".join(block_lines[line_idx:-1]				)
      snake_case_            =       get_indent(block_lines[1]				)
      # Slit the internal block into blocks of indent level 1.
      snake_case_            =       split_code_in_indented_blocks(lowerCAmelCase_		,    indent_level=lowerCAmelCase_				)
      # We have two categories of import key: list or _import_structure[key].append/extend
      snake_case_            =       _re_direct_key if "_import_structure = {" in block_lines[0] else _re_indirect_key
      # Grab the keys, but there is a trap: some lines are empty or just comments.
      snake_case_            =       [(pattern.search(lowerCAmelCase_				).groups()[0] if pattern.search(lowerCAmelCase_				) is not None else None) for b in internal_blocks]
      # We only sort the lines with a key.
      snake_case_            =       [(i, key) for i, key in enumerate(lowerCAmelCase_				) if key is not None]
      snake_case_            =       [x[0] for x in sorted(lowerCAmelCase_		,    key=lambda lowerCAmelCase_				: x[1]				)]

      # We reorder the blocks by leaving empty lines/comments as they were and reorder the rest.
      snake_case_            =       0
      snake_case_            =       []
      for i in range(len(lowerCAmelCase_				)				):
         if keys[i] is None:
            reorderded_blocks.append(internal_blocks[i]				)
         else:
            snake_case_            =       sort_objects_in_import(internal_blocks[sorted_indices[count]]				)
            reorderded_blocks.append(lowerCAmelCase_				)
            count += 1

        # And we put our main block back together with its first and last line.
      snake_case_            =       "\n".join(block_lines[:line_idx] + reorderded_blocks + [block_lines[-1]]				)

   if code != "\n".join(lowerCAmelCase_				):
      if check_only:
         return True
      else:
         print(F'''Overwriting {file}.'''				)
         with open(lowerCAmelCase_		,    "w"		,    encoding="utf-8"				) as f:
            f.write("\n".join(lowerCAmelCase_				)				)



def       _lowerCAmelCase    (				lowerCAmelCase_				:Dict=True				)->List[Any]:
   '''simple docstring'''






   snake_case_            =       []
   for root, _, files in os.walk(lowerCAmelCase_				):
      if "__init__.py" in files:
         snake_case_            =       sort_imports(os.path.join(lowerCAmelCase_		,    "__init__.py"				)		,    check_only=lowerCAmelCase_				)
         if result:
            snake_case_            =       [os.path.join(lowerCAmelCase_		,    "__init__.py"				)]
   if len(lowerCAmelCase_				) > 0:
      raise ValueError(F'''Would overwrite {len(lowerCAmelCase_				)} files, run `make style`.'''				)


if __name__ == "__main__":
   SCREAMING_SNAKE_CASE						:int			=  argparse.ArgumentParser()
   parser.add_argument('''--check_only''', action='''store_true''', help='''Whether to only check or fix style.''')
   SCREAMING_SNAKE_CASE						:int			=  parser.parse_args()

   sort_imports_in_all_inits(check_only=args.check_only)








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       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							DownBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  def        lowerCAmelCase__	(  self							:							int	) ->			Tuple:




     """simple docstring"""
     snake_case_            =       [-0.0_232, -0.9_869, 0.8_054, -0.0_637, -0.1_688, -1.4_264, 0.4_470, -1.3_394, 0.0_904]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							ResnetDownsampleBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  def        lowerCAmelCase__	(  self							:							Any	) ->			Union[str, Any]:




     """simple docstring"""
     snake_case_            =       [0.0_710, 0.2_410, -0.7_320, -1.0_757, -1.1_343, 0.3_540, -0.0_133, -0.2_576, 0.0_948]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							AttnDownBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			Tuple:




     """simple docstring"""
     snake_case_            =       [0.0_636, 0.8_964, -0.6_234, -1.0_131, 0.0_844, 0.4_935, 0.3_437, 0.0_911, -0.2_957]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							CrossAttnDownBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  def        lowerCAmelCase__	(  self							:							str	) ->			Tuple:




     """simple docstring"""
     snake_case_     ,     snake_case_            =       super().prepare_init_args_and_inputs_for_common()
     snake_case_            =       3_2
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							List[Any]	) ->			str:




     """simple docstring"""
     snake_case_            =       [0.2_238, -0.7_396, -0.2_255, -0.3_829, 0.1_925, 1.1_665, 0.0_603, -0.7_295, 0.1_983]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							SimpleCrossAttnDownBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  @property
  def        lowerCAmelCase__	(  self							:							Dict	) ->			Any:




     """simple docstring"""
     return super().get_dummy_input(include_encoder_hidden_states=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							List[Any]	) ->			Optional[int]:




     """simple docstring"""
     snake_case_     ,     snake_case_            =       super().prepare_init_args_and_inputs_for_common()
     snake_case_            =       3_2
     return init_dict, inputs_dict



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




     """simple docstring"""
     snake_case_            =       [0.7_921, -0.0_992, -0.1_962, -0.7_695, -0.4_242, 0.7_804, 0.4_737, 0.2_765, 0.3_338]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							SkipDownBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  @property
  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			Tuple:




     """simple docstring"""
     return super().get_dummy_input(include_skip_sample=_lowerCAmelCase	)



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




     """simple docstring"""
     snake_case_            =       [-0.0_845, -0.2_087, -0.2_465, 0.0_971, 0.1_900, -0.0_484, 0.2_664, 0.4_179, 0.5_069]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							AttnSkipDownBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  @property
  def        lowerCAmelCase__	(  self							:							Any	) ->			Dict:




     """simple docstring"""
     return super().get_dummy_input(include_skip_sample=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			Any:




     """simple docstring"""
     snake_case_            =       [0.5_539, 0.1_609, 0.4_924, 0.0_537, -0.1_995, 0.4_050, 0.0_979, -0.2_721, -0.0_642]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							DownEncoderBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  @property
  def        lowerCAmelCase__	(  self							:							int	) ->			Optional[Any]:




     """simple docstring"""
     return super().get_dummy_input(include_temb=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			Dict:




     """simple docstring"""
     snake_case_            =       {
         "in_channels": 3_2,
         "out_channels": 3_2,
     }
     snake_case_            =       self.dummy_input
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							Optional[int]	) ->			List[Any]:




     """simple docstring"""
     snake_case_            =       [1.1_102, 0.5_302, 0.4_872, -0.0_023, -0.8_042, 0.0_483, -0.3_489, -0.5_632, 0.7_626]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							AttnDownEncoderBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'down'



  @property
  def        lowerCAmelCase__	(  self							:							str	) ->			Optional[Any]:




     """simple docstring"""
     return super().get_dummy_input(include_temb=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							int	) ->			Dict:




     """simple docstring"""
     snake_case_            =       {
         "in_channels": 3_2,
         "out_channels": 3_2,
     }
     snake_case_            =       self.dummy_input
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							List[str]	) ->			Any:




     """simple docstring"""
     snake_case_            =       [0.8_966, -0.1_486, 0.8_568, 0.8_141, -0.9_046, -0.1_342, -0.0_972, -0.7_417, 0.1_538]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							UNetMidBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'mid'



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




     """simple docstring"""
     snake_case_            =       {
         "in_channels": 3_2,
         "temb_channels": 1_2_8,
     }
     snake_case_            =       self.dummy_input
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			int:




     """simple docstring"""
     snake_case_            =       [-0.1_062, 1.7_248, 0.3_494, 1.4_569, -0.0_910, -1.2_421, -0.9_984, 0.6_736, 1.0_028]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							UNetMidBlockaDCrossAttn  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'mid'



  def        lowerCAmelCase__	(  self							:							int	) ->			List[Any]:




     """simple docstring"""
     snake_case_     ,     snake_case_            =       super().prepare_init_args_and_inputs_for_common()
     snake_case_            =       3_2
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							Tuple	) ->			Any:




     """simple docstring"""
     snake_case_            =       [0.0_187, 2.4_220, 0.4_484, 1.1_203, -0.6_121, -1.5_122, -0.8_270, 0.7_851, 1.8_335]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							UNetMidBlockaDSimpleCrossAttn  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'mid'



  @property
  def        lowerCAmelCase__	(  self							:							Tuple	) ->			Any:




     """simple docstring"""
     return super().get_dummy_input(include_encoder_hidden_states=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							Optional[Any]	) ->			Union[str, Any]:




     """simple docstring"""
     snake_case_     ,     snake_case_            =       super().prepare_init_args_and_inputs_for_common()
     snake_case_            =       3_2
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			Optional[Any]:




     """simple docstring"""
     snake_case_            =       [0.7_143, 1.9_974, 0.5_448, 1.3_977, 0.1_282, -1.1_237, -1.4_238, 0.5_530, 0.8_880]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							UpBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							Dict	) ->			List[Any]:




     """simple docstring"""
     return super().get_dummy_input(include_res_hidden_states_tuple=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							str	) ->			Any:




     """simple docstring"""
     snake_case_            =       [-0.2_041, -0.4_165, -0.3_022, 0.0_041, -0.6_628, -0.7_053, 0.1_928, -0.0_325, 0.0_523]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							ResnetUpsampleBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							str	) ->			int:




     """simple docstring"""
     return super().get_dummy_input(include_res_hidden_states_tuple=_lowerCAmelCase	)



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




     """simple docstring"""
     snake_case_            =       [0.2_287, 0.3_549, -0.1_346, 0.4_797, -0.1_715, -0.9_649, 0.7_305, -0.5_864, -0.6_244]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							CrossAttnUpBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							List[str]	) ->			List[str]:




     """simple docstring"""
     return super().get_dummy_input(include_res_hidden_states_tuple=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							List[str]	) ->			Optional[Any]:




     """simple docstring"""
     snake_case_     ,     snake_case_            =       super().prepare_init_args_and_inputs_for_common()
     snake_case_            =       3_2
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			List[Any]:




     """simple docstring"""
     snake_case_            =       [-0.1_403, -0.3_515, -0.0_420, -0.1_425, 0.3_167, 0.5_094, -0.2_181, 0.5_931, 0.5_582]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							SimpleCrossAttnUpBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							int	) ->			List[Any]:




     """simple docstring"""
     return super().get_dummy_input(include_res_hidden_states_tuple=_lowerCAmelCase     ,					include_encoder_hidden_states=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							Tuple	) ->			Any:




     """simple docstring"""
     snake_case_     ,     snake_case_            =       super().prepare_init_args_and_inputs_for_common()
     snake_case_            =       3_2
     return init_dict, inputs_dict



  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			Optional[int]:




     """simple docstring"""
     snake_case_            =       [0.2_645, 0.1_480, 0.0_909, 0.8_044, -0.9_758, -0.9_083, 0.0_994, -1.1_453, -0.7_402]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							AttnUpBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							List[Any]	) ->			Tuple:




     """simple docstring"""
     return super().get_dummy_input(include_res_hidden_states_tuple=_lowerCAmelCase	)



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




     """simple docstring"""
     snake_case_            =       [0.0_979, 0.1_326, 0.0_021, 0.0_659, 0.2_249, 0.0_059, 0.1_132, 0.5_952, 0.1_033]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							SkipUpBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							List[str]	) ->			str:




     """simple docstring"""
     return super().get_dummy_input(include_res_hidden_states_tuple=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							Tuple	) ->			str:




     """simple docstring"""
     snake_case_            =       [-0.0_893, -0.1_234, -0.1_506, -0.0_332, 0.0_123, -0.0_211, 0.0_566, 0.0_143, 0.0_362]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							AttnSkipUpBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							int	) ->			List[str]:




     """simple docstring"""
     return super().get_dummy_input(include_res_hidden_states_tuple=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							Optional[int]	) ->			Dict:




     """simple docstring"""
     snake_case_            =       [0.0_361, 0.0_617, 0.2_787, -0.0_350, 0.0_342, 0.3_421, -0.0_843, 0.0_913, 0.3_015]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							UpDecoderBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							Union[str, Any]	) ->			Optional[int]:




     """simple docstring"""
     return super().get_dummy_input(include_temb=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							Any	) ->			Any:




     """simple docstring"""
     snake_case_            =       {"in_channels": 3_2, "out_channels": 3_2}

     snake_case_            =       self.dummy_input
     return init_dict, inputs_dict



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




     """simple docstring"""
     snake_case_            =       [0.4_404, 0.1_998, -0.9_886, -0.3_320, -0.3_128, -0.7_034, -0.6_955, -0.2_338, -0.3_137]
     super().test_output(_lowerCAmelCase	)






class      __lowerCAmelCase  (			a			,	unittest.TestCase       ):






  """simple docstring"""





  _SCREAMING_SNAKE_CASE		     =							AttnUpDecoderBlockaD  # noqa F405
  _SCREAMING_SNAKE_CASE		     =							'up'



  @property
  def        lowerCAmelCase__	(  self							:							Tuple	) ->			int:




     """simple docstring"""
     return super().get_dummy_input(include_temb=_lowerCAmelCase	)



  def        lowerCAmelCase__	(  self							:							int	) ->			Dict:




     """simple docstring"""
     snake_case_            =       {"in_channels": 3_2, "out_channels": 3_2}

     snake_case_            =       self.dummy_input
     return init_dict, inputs_dict



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




     """simple docstring"""
     snake_case_            =       [0.6_738, 0.4_491, 0.1_055, 1.0_710, 0.7_316, 0.3_339, 0.3_352, 0.1_023, 0.3_568]
     super().test_output(_lowerCAmelCase	)




