





import flax.linen as nn
import jax
import jax.numpy as jnp

class 		SCREAMING_SNAKE_CASE__				(       nn.Module  ):
      A_						:				int
      A_						:				jnp.dtype							=    jnp.floataa


      def    a (self       :      str      ):





         """simple docstring"""



         __snake_case							       =   nn.Conv(
             self.out_channels				,			kernel_size=(3, 3)				,			strides=(1, 1)				,			padding=((1, 1), (1, 1))				,			dtype=self.dtype				,			)


      def __call__(self       :      Dict				,			a__       :      Any      ):





         """simple docstring"""



         __snake_case       ,	__snake_case       ,	__snake_case       ,	__snake_case							       =   hidden_states.shape
         __snake_case							       =   jax.image.resize(
             a__				,			shape=(batch, height * 2, width * 2, channels)				,			method='''nearest'''				,			)
         __snake_case							       =   self.conv(a__      )
         return hidden_states






class 		SCREAMING_SNAKE_CASE__				(       nn.Module  ):
      A_						:				int
      A_						:				jnp.dtype							=    jnp.floataa


      def    a (self       :      Dict      ):





         """simple docstring"""



         __snake_case							       =   nn.Conv(
             self.out_channels				,			kernel_size=(3, 3)				,			strides=(2, 2)				,			padding=((1, 1), (1, 1))				,			dtype=self.dtype				,			)


      def __call__(self       :      Dict				,			a__       :      List[Any]      ):





         """simple docstring"""



         __snake_case							       =   self.conv(a__      )
         return hidden_states






class 		SCREAMING_SNAKE_CASE__				(       nn.Module  ):
      A_						:				int
      A_						:				int							=    None
      A_						:				float							=    0.0
      A_						:				bool							=    None
      A_						:				jnp.dtype							=    jnp.floataa


      def    a (self       :      Union[str, Any]      ):





         """simple docstring"""



         __snake_case							       =   self.in_channels if self.out_channels is None else self.out_channels

         __snake_case							       =   nn.GroupNorm(num_groups=32				,			epsilon=1E-5      )
         __snake_case							       =   nn.Conv(
             a__				,			kernel_size=(3, 3)				,			strides=(1, 1)				,			padding=((1, 1), (1, 1))				,			dtype=self.dtype				,			)

         __snake_case							       =   nn.Dense(a__				,			dtype=self.dtype      )

         __snake_case							       =   nn.GroupNorm(num_groups=32				,			epsilon=1E-5      )
         __snake_case							       =   nn.Dropout(self.dropout_prob      )
         __snake_case							       =   nn.Conv(
             a__				,			kernel_size=(3, 3)				,			strides=(1, 1)				,			padding=((1, 1), (1, 1))				,			dtype=self.dtype				,			)

         __snake_case							       =   self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

         __snake_case							       =   None
         if use_nin_shortcut:
            __snake_case							       =   nn.Conv(
                a__				,			kernel_size=(1, 1)				,			strides=(1, 1)				,			padding='''VALID'''				,			dtype=self.dtype				,			)


      def __call__(self       :      Optional[Any]				,			a__       :      int				,			a__       :      List[Any]				,			a__       :      str=True      ):





         """simple docstring"""



         __snake_case							       =   hidden_states
         __snake_case							       =   self.norma(a__      )
         __snake_case							       =   nn.swish(a__      )
         __snake_case							       =   self.conva(a__      )

         __snake_case							       =   self.time_emb_proj(nn.swish(a__      )      )
         __snake_case							       =   jnp.expand_dims(jnp.expand_dims(a__				,			1      )				,			1      )
         __snake_case							       =   hidden_states + temb

         __snake_case							       =   self.norma(a__      )
         __snake_case							       =   nn.swish(a__      )
         __snake_case							       =   self.dropout(a__				,			a__      )
         __snake_case							       =   self.conva(a__      )

         if self.conv_shortcut is not None:
            __snake_case							       =   self.conv_shortcut(a__      )

         return hidden_states + residual








from math import loga






def lowerCamelCase__    (							snake_case_	:  int       )      ->				int:
   if a < 0:
      raise ValueError('''Input value must be a positive integer'''       )
   elif isinstance(snake_case_       ,      snake_case_       ):
      raise TypeError('''Input value must be a \'int\' type'''       )
   return 0 if (a == 0) else int(loga(a & -a       )       )


if __name__ == "__main__":
    import doctest

    doctest.testmod()

