






from abc import ABC, abstractmethod
from typing import List, Optional




class 							_lowerCAmelCase(			UpperCAmelCase_   ):





       """simple docstring"""







       def __init__(   self				):
         # test for the above condition
         self.test()





       def      _a       (   self				):
         UpperCamelCase_:   List[str]        =							0
         UpperCamelCase_:   List[Any]        =							False
         while not completed:
           if counter == 1:
             self.reset()
           UpperCamelCase_:   Union[str, Any]        =							self.advance()
           if not self.does_advance(_lowerCamelCase				):
             raise Exception(
                 'Custom Constraint is not defined correctly. self.does_advance(self.advance()) must be true.'				)

           UpperCamelCase_ ,UpperCamelCase_ ,UpperCamelCase_:   int        =							self.update(_lowerCamelCase				)
           counter += 1

           if counter > 1_0_0_0_0:
             raise Exception('update() does not fulfill the constraint.'				)

         if self.remaining() != 0:
           raise Exception('Custom Constraint is not defined correctly.'				)





       @abstractmethod
       def      _a       (   self				):
         raise NotImplementedError(
             f'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''				)





       @abstractmethod
       def      _a       (   self    ,     _lowerCamelCase				):
         raise NotImplementedError(
             f'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''				)





       @abstractmethod
       def      _a       (   self    ,     _lowerCamelCase				):
         raise NotImplementedError(
             f'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''				)





       @abstractmethod
       def      _a       (   self				):
         raise NotImplementedError(
             f'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''				)





       @abstractmethod
       def      _a       (   self				):
         raise NotImplementedError(
             f'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''				)





       @abstractmethod
       def      _a       (   self    ,     _lowerCamelCase=False				):
         raise NotImplementedError(
             f'''{self.__class__} is an abstract class. Only classes inheriting this class can be called.'''				)







class 							_lowerCAmelCase(			UpperCAmelCase_   ):





       """simple docstring"""







       def __init__(   self    ,     _lowerCamelCase				):
         super(_lowerCamelCase    ,     self				).__init__()

         if not isinstance(_lowerCamelCase    ,     _lowerCamelCase				) or len(_lowerCamelCase				) == 0:
           raise ValueError(f'''`token_ids` has to be a non-empty list, but is {token_ids}.'''				)
         if any((not isinstance(_lowerCamelCase    ,     _lowerCamelCase				) or token_id < 0) for token_id in token_ids				):
           raise ValueError(f'''Each list in `token_ids` has to be a list of positive integers, but is {token_ids}.'''				)

         UpperCamelCase_:   Optional[Any]        =							token_ids

         UpperCamelCase_:   Optional[int]        =							len(self.token_ids				)
         UpperCamelCase_:   Union[str, Any]        =							-1  # the index of the currently fulfilled step
         UpperCamelCase_:   List[str]        =							False





       def      _a       (   self				):
         if self.completed:
           return None
         return self.token_ids[self.fulfilled_idx + 1]





       def      _a       (   self    ,     _lowerCamelCase				):
         if not isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
           raise ValueError(f'''`token_id` has to be an `int`, but is {token_id} of type {type(_lowerCamelCase				)}'''				)

         if self.completed:
           return False

         return token_id == self.token_ids[self.fulfilled_idx + 1]





       def      _a       (   self    ,     _lowerCamelCase				):
         if not isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
           raise ValueError(f'''`token_id` has to be an `int`, but is {token_id} of type {type(_lowerCamelCase				)}'''				)

         UpperCamelCase_:   Dict        =							False
         UpperCamelCase_:   Optional[Any]        =							False
         UpperCamelCase_:   int        =							False

         if self.does_advance(_lowerCamelCase				):
           self.fulfilled_idx += 1
           UpperCamelCase_:   Tuple        =							True
           if self.fulfilled_idx == (self.seqlen - 1):
             UpperCamelCase_:   Tuple        =							True
           UpperCamelCase_:   List[Any]        =							completed
         else:
           # failed to make progress.
           UpperCamelCase_:   Tuple        =							True
           self.reset()
         return stepped, completed, reset





       def      _a       (   self				):
         UpperCamelCase_:   str        =							False
         UpperCamelCase_:   List[Any]        =							0





       def      _a       (   self				):
         return self.seqlen - (self.fulfilled_idx + 1)





       def      _a       (   self    ,     _lowerCamelCase=False				):
         UpperCamelCase_:   Union[str, Any]        =							PhrasalConstraint(self.token_ids				)

         if stateful:
           UpperCamelCase_:   Any        =							self.seqlen
           UpperCamelCase_:   Any        =							self.fulfilled_idx
           UpperCamelCase_:   List[Any]        =							self.completed

         return new_constraint







class 							_lowerCAmelCase:





       """simple docstring"""







       def __init__(   self    ,     _lowerCamelCase    ,     _lowerCamelCase=True				):
         UpperCamelCase_:   Dict        =							max([len(_lowerCamelCase				) for one in nested_token_ids]				)

         UpperCamelCase_:   Dict        =							{}
         for token_ids in nested_token_ids:
           UpperCamelCase_:   str        =							root
           for tidx, token_id in enumerate(_lowerCamelCase				):
             if token_id not in level:
               UpperCamelCase_:   Optional[Any]        =							{}

             UpperCamelCase_:   Dict        =							level[token_id]

         if no_subsets and self.has_subsets(_lowerCamelCase    ,     _lowerCamelCase				):
           raise ValueError(
               'Each list in `nested_token_ids` can\'t be a complete subset of another list, but is'
               f''' {nested_token_ids}.'''				)

         UpperCamelCase_:   int        =							root





       def      _a       (   self    ,     _lowerCamelCase				):
         UpperCamelCase_:   Union[str, Any]        =							self.trie

         for current_token in current_seq:
           UpperCamelCase_:   Optional[Any]        =							start[current_token]

         UpperCamelCase_:   Dict        =							list(start.keys()				)

         return next_tokens





       def      _a       (   self    ,     _lowerCamelCase				):
         UpperCamelCase_:   Tuple        =							self.next_tokens(_lowerCamelCase				)

         return len(_lowerCamelCase				) == 0





       def      _a       (   self    ,     _lowerCamelCase				):
         UpperCamelCase_:   Union[str, Any]        =							list(root.values()				)
         if len(_lowerCamelCase				) == 0:
           return 1
         else:
           return sum([self.count_leaves(_lowerCamelCase				) for nn in next_nodes]				)





       def      _a       (   self    ,     _lowerCamelCase    ,     _lowerCamelCase				):
         UpperCamelCase_:   str        =							self.count_leaves(_lowerCamelCase				)
         return len(_lowerCamelCase				) != leaf_count







class 							_lowerCAmelCase(			UpperCAmelCase_   ):





       """simple docstring"""







       def __init__(   self    ,     _lowerCamelCase				):
         super(_lowerCamelCase    ,     self				).__init__()

         if not isinstance(_lowerCamelCase    ,     _lowerCamelCase				) or len(_lowerCamelCase				) == 0:
           raise ValueError(f'''`nested_token_ids` has to be a non-empty list, but is {nested_token_ids}.'''				)
         if any(not isinstance(_lowerCamelCase    ,     _lowerCamelCase				) for token_ids in nested_token_ids				):
           raise ValueError(f'''`nested_token_ids` has to be a list of lists, but is {nested_token_ids}.'''				)
         if any(
             any((not isinstance(_lowerCamelCase    ,     _lowerCamelCase				) or token_id < 0) for token_id in token_ids				)
             for token_ids in nested_token_ids				):
           raise ValueError(
               f'''Each list in `nested_token_ids` has to be a list of positive integers, but is {nested_token_ids}.'''				)

         UpperCamelCase_:   Any        =							DisjunctiveTrie(_lowerCamelCase				)
         UpperCamelCase_:   Dict        =							nested_token_ids

         UpperCamelCase_:   Union[str, Any]        =							self.trie.max_height
         UpperCamelCase_:   Any        =							[]
         UpperCamelCase_:   Optional[Any]        =							False





       def      _a       (   self				):
         UpperCamelCase_:   Optional[int]        =							self.trie.next_tokens(self.current_seq				)

         if len(_lowerCamelCase				) == 0:
           return None
         else:
           return token_list





       def      _a       (   self    ,     _lowerCamelCase				):
         if not isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
           raise ValueError(f'''`token_id` is supposed to be type `int`, but is {token_id} of type {type(_lowerCamelCase				)}'''				)

         UpperCamelCase_:   Union[str, Any]        =							self.trie.next_tokens(self.current_seq				)

         return token_id in next_tokens





       def      _a       (   self    ,     _lowerCamelCase				):
         if not isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
           raise ValueError(f'''`token_id` is supposed to be type `int`, but is {token_id} of type {type(_lowerCamelCase				)}'''				)

         UpperCamelCase_:   int        =							False
         UpperCamelCase_:   Dict        =							False
         UpperCamelCase_:   int        =							False

         if self.does_advance(_lowerCamelCase				):
           self.current_seq.append(_lowerCamelCase				)
           UpperCamelCase_:   List[str]        =							True
         else:
           UpperCamelCase_:   Tuple        =							True
           self.reset()

         UpperCamelCase_:   Any        =							self.trie.reached_leaf(self.current_seq				)
         UpperCamelCase_:   Union[str, Any]        =							completed

         return stepped, completed, reset





       def      _a       (   self				):
         UpperCamelCase_:   Dict        =							False
         UpperCamelCase_:   List[str]        =							[]





       def      _a       (   self				):
         if self.completed:
           # since this can be completed without reaching max height
           return 0
         else:
           return self.seqlen - len(self.current_seq				)





       def      _a       (   self    ,     _lowerCamelCase=False				):
         UpperCamelCase_:   Optional[int]        =							DisjunctiveConstraint(self.token_ids				)

         if stateful:
           UpperCamelCase_:   str        =							self.seqlen
           UpperCamelCase_:   Any        =							self.current_seq
           UpperCamelCase_:   Any        =							self.completed

         return new_constraint







class 							_lowerCAmelCase:





       """simple docstring"""







       def __init__(   self    ,     _lowerCamelCase				):
         UpperCamelCase_:   Tuple        =							constraints

         # max # of steps required to fulfill a given constraint
         UpperCamelCase_:   List[Any]        =							max([c.seqlen for c in constraints]				)
         UpperCamelCase_:   Optional[int]        =							len(_lowerCamelCase				)
         UpperCamelCase_:   Optional[Any]        =							False

         self.init_state()





       def      _a       (   self				):
         UpperCamelCase_:   str        =							[]
         UpperCamelCase_:   Union[str, Any]        =							None
         UpperCamelCase_:   Tuple        =							[constraint.copy(stateful=_lowerCamelCase				) for constraint in self.constraints]





       def      _a       (   self				):
         UpperCamelCase_:   Tuple        =							0
         if self.inprogress_constraint:
           # extra points for having a constraint mid-fulfilled
           add += self.max_seqlen - self.inprogress_constraint.remaining()

         return (len(self.complete_constraints				) * self.max_seqlen) + add





       def      _a       (   self				):
         UpperCamelCase_:   List[str]        =							[]
         if self.inprogress_constraint is None:
           for constraint in self.pending_constraints:  # "pending" == "unfulfilled yet"
             UpperCamelCase_:   Tuple        =							constraint.advance()
             if isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
               token_list.append(_lowerCamelCase				)
             elif isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
               token_list.extend(_lowerCamelCase				)
         else:
           UpperCamelCase_:   Dict        =							self.inprogress_constraint.advance()
           if isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
             token_list.append(_lowerCamelCase				)
           elif isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
             token_list.extend(_lowerCamelCase				)

         if len(_lowerCamelCase				) == 0:
           return None
         else:
           return token_list





       def      _a       (   self    ,     _lowerCamelCase				):
         self.init_state()

         if token_ids is not None:
           for token in token_ids:
             # completes or steps **one** constraint
             UpperCamelCase_ ,UpperCamelCase_:   Any        =							self.add(_lowerCamelCase				)

             # the entire list of constraints are fulfilled
             if self.completed:
               break





       def      _a       (   self    ,     _lowerCamelCase				):
         if not isinstance(_lowerCamelCase    ,     _lowerCamelCase				):
           raise ValueError(f'''`token_id` should be an `int`, but is `{token_id}`.'''				)

         UpperCamelCase_ ,UpperCamelCase_:   int        =							False, False

         if self.completed:
           UpperCamelCase_:   List[Any]        =							True
           UpperCamelCase_:   List[Any]        =							False
           return complete, stepped

         if self.inprogress_constraint is not None:
           # In the middle of fulfilling a constraint. If the `token_id` *does* makes an incremental progress to current
           # job, simply update the state

           UpperCamelCase_ ,UpperCamelCase_ ,UpperCamelCase_:   Optional[Any]        =							self.inprogress_constraint.update(_lowerCamelCase				)
           if reset:
             # 1. If the next token breaks the progress, then we must restart.
             #     e.g. constraint = "I love pies" and sequence so far is "I love" but `token_id` == "books".

             #     But that doesn't mean we self.init_state(), since we only reset the state for this particular
             #     constraint, not the full list of constraints.

             self.pending_constraints.append(self.inprogress_constraint.copy(stateful=_lowerCamelCase				)				)
             UpperCamelCase_:   str        =							None

           if complete:
             # 2. If the next token completes the constraint, move it to completed list, set
             #     inprogress to None. If there are no pending constraints either, then this full list of constraints
             #     is complete.

             self.complete_constraints.append(self.inprogress_constraint				)
             UpperCamelCase_:   List[Any]        =							None

             if len(self.pending_constraints				) == 0:
               # we're done!
               UpperCamelCase_:   Any        =							True

         else:
           # Not in the middle of fulfilling a constraint. So does this `token_id` helps us step towards any of our list
           # of constraints?

           for cidx, pending_constraint in enumerate(self.pending_constraints				):
             if pending_constraint.does_advance(_lowerCamelCase				):
               UpperCamelCase_ ,UpperCamelCase_ ,UpperCamelCase_:   int        =							pending_constraint.update(_lowerCamelCase				)

               if not stepped:
                 raise Exception(
                     '`constraint.update(token_id)` is not yielding incremental progress, '
                     'even though `constraint.does_advance(token_id)` is true.'				)

               if complete:
                 self.complete_constraints.append(_lowerCamelCase				)
                 UpperCamelCase_:   Union[str, Any]        =							None

               if not complete and stepped:
                 UpperCamelCase_:   List[str]        =							pending_constraint

               if complete or stepped:
                 # If we made any progress at all, then it's at least not a "pending constraint".

                 UpperCamelCase_:   List[Any]        =							(
                     self.pending_constraints[:cidx] + self.pending_constraints[cidx + 1 :]
                 )

                 if len(self.pending_constraints				) == 0 and self.inprogress_constraint is None:
                   # If there's no longer any pending after this and no inprogress either, then we must be
                   # complete.

                   UpperCamelCase_:   str        =							True

                 break  # prevent accidentally stepping through multiple constraints with just one token.

         return complete, stepped





       def      _a       (   self    ,     _lowerCamelCase=True				):
         UpperCamelCase_:   List[Any]        =							ConstraintListState(self.constraints				)  # we actually never though self.constraints objects
         # throughout this process. So it's at initialization state.

         if stateful:
           UpperCamelCase_:   Optional[int]        =							[
               constraint.copy(stateful=_lowerCamelCase				) for constraint in self.complete_constraints
           ]
           if self.inprogress_constraint is not None:
             UpperCamelCase_:   Tuple        =							self.inprogress_constraint.copy(stateful=_lowerCamelCase				)
           UpperCamelCase_:   Optional[int]        =							[constraint.copy() for constraint in self.pending_constraints]

         return new_state



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	)




