
class  _lowerCamelCase			:







     class  _lowerCamelCase			:
          lowercase__				  =			"""_prev""", """_data""", """_next"""

          def __init__(  self							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_    ):
                 __snake_case						       =   link_p
                 __snake_case						       =   element
                 __snake_case						       =   link_n

          def 						__lowerCamelCase				(  self    ):
                 return (
                     f''' Prev -> {self._prev is not None}, Next -> {self._next is not None}'''
                 )





     def __init__(  self    ):
            __snake_case						       =   self._Node(SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_    )
            __snake_case						       =   self._Node(SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_    )
            __snake_case						       =   self._trailer
            __snake_case						       =   self._header
            __snake_case						       =   0

     def __len__(  self    ):
            return self._size

     def 						__lowerCamelCase				(  self    ):
            return self.__len__() == 0

     def 						__lowerCamelCase				(  self							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_    ):
            # Create new_node by setting it's prev.link -> header
            # setting it's next.link -> trailer
            __snake_case						       =   self._Node(SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_    )
            __snake_case						       =   new_node
            __snake_case						       =   new_node
            self._size += 1
            return self

     def 						__lowerCamelCase				(  self							,       SCREAMING_SNAKE_CASE_    ):
            __snake_case						       =   node._prev
            __snake_case						       =   node._next

            __snake_case						       =   successor
            __snake_case						       =   predecessor
            self._size -= 1
            __snake_case						       =   node._data
            __snake_case						       =   None
            del node
            return temp







class  _lowerCamelCase			(_DoublyLinkedBase					):

     def 						__lowerCamelCase				(  self    ):
            if self.is_empty():
                   raise Exception('List is empty'    )
            return self._header._next._data

     def 						__lowerCamelCase				(  self    ):
            if self.is_empty():
                   raise Exception('List is empty'    )
            return self._trailer._prev._data

     def 						__lowerCamelCase				(  self							,       SCREAMING_SNAKE_CASE_    ):
            return self._insert(self._header							,       SCREAMING_SNAKE_CASE_							,       self._header._next    )

     def 						__lowerCamelCase				(  self							,       SCREAMING_SNAKE_CASE_    ):
            return self._insert(self._trailer._prev							,       SCREAMING_SNAKE_CASE_							,       self._trailer    )

     def 						__lowerCamelCase				(  self    ):
            if self.is_empty():
                   raise IndexError('remove_first from empty list'    )
            return self._delete(self._header._next    )

     def 						__lowerCamelCase				(  self    ):
            if self.is_empty():
                   raise IndexError('remove_first from empty list'    )
            return self._delete(self._trailer._prev    )





"""simple docstring"""







import inspect

from diffusers.utils import is_flax_available
from diffusers.utils.testing_utils import require_flax


if is_flax_available():
     import jax







@require_flax
class  UpperCamelCase__  :




      """simple docstring"""




      def 	SCREAMING_SNAKE_CASE__					( self							: Optional[int]			):
        lowerCAmelCase_		,lowerCAmelCase_  :							Any								=					self.prepare_init_args_and_inputs_for_common()

        lowerCAmelCase_  :							List[str]								=					self.model_class(**SCREAMING_SNAKE_CASE_			)
        lowerCAmelCase_  :							Any								=					model.init(inputs_dict['prng_key']       ,     inputs_dict['sample']			)
        jax.lax.stop_gradient(SCREAMING_SNAKE_CASE_			)

        lowerCAmelCase_  :							Tuple								=					model.apply(SCREAMING_SNAKE_CASE_       ,     inputs_dict['sample']			)

        if isinstance(SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_			):
          lowerCAmelCase_  :							str								=					output.sample

        self.assertIsNotNone(SCREAMING_SNAKE_CASE_			)
        lowerCAmelCase_  :							Any								=					inputs_dict['sample'].shape
        self.assertEqual(output.shape       ,     SCREAMING_SNAKE_CASE_       ,     'Input and output shapes do not match'			)



      def 	SCREAMING_SNAKE_CASE__					( self							: List[str]			):
        lowerCAmelCase_		,lowerCAmelCase_  :							Union[str, Any]								=					self.prepare_init_args_and_inputs_for_common()

        lowerCAmelCase_  :							Tuple								=					1_6
        lowerCAmelCase_  :							Dict								=					(1_6, 3_2)

        lowerCAmelCase_  :							Any								=					self.model_class(**SCREAMING_SNAKE_CASE_			)
        lowerCAmelCase_  :							Optional[Any]								=					model.init(inputs_dict['prng_key']       ,     inputs_dict['sample']			)
        jax.lax.stop_gradient(SCREAMING_SNAKE_CASE_			)

        lowerCAmelCase_  :							Optional[Any]								=					model.apply(SCREAMING_SNAKE_CASE_       ,     inputs_dict['sample']			)

        if isinstance(SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_			):
          lowerCAmelCase_  :							Dict								=					output.sample

        self.assertIsNotNone(SCREAMING_SNAKE_CASE_			)
        lowerCAmelCase_  :							Optional[Any]								=					inputs_dict['sample'].shape
        self.assertEqual(output.shape       ,     SCREAMING_SNAKE_CASE_       ,     'Input and output shapes do not match'			)





      def 	SCREAMING_SNAKE_CASE__					( self							: List[Any]			):
        lowerCAmelCase_  :							List[str]								=					'kwargs' in inspect.signature(self.model_class.__init__			).parameters
        lowerCAmelCase_  :							Optional[Any]								=					len(self.model_class._deprecated_kwargs			) > 0

        if has_kwarg_in_model_class and not has_deprecated_kwarg:
          raise ValueError(
              F"{self.model_class} has `**kwargs` in its __init__ method but has not defined any deprecated kwargs"
              ' under the `_deprecated_kwargs` class attribute. Make sure to either remove `**kwargs` if there are'
              ' no deprecated arguments or add the deprecated argument with `_deprecated_kwargs ='
              ' [<deprecated_argument>]`'			)

        if not has_kwarg_in_model_class and has_deprecated_kwarg:
          raise ValueError(
              F"{self.model_class} doesn't have `**kwargs` in its __init__ method but has defined deprecated kwargs"
              ' under the `_deprecated_kwargs` class attribute. Make sure to either add the `**kwargs` argument to'
              F" {self.model_class}.__init__ if there are deprecated arguments or remove the deprecated argument"
              ' from `_deprecated_kwargs = [<deprecated_argument>]`'			)





