






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




class 			snake_case__   (							nn.Module):

       '''simple docstring'''
       lowerCamelCase							:				int
       lowerCamelCase							:				jnp.dtype 				= jnp.floataa



       def 					__lowercase						(							self    ) ->      int:






            '''simple docstring'''





            __snake_case			:Union[str, Any]          =						nn.Conv(
                self.out_channels			,						kernel_size=(3, 3)			,						strides=(1, 1)			,						padding=((1, 1), (1, 1))			,						dtype=self.dtype			,						)



       def __call__(							self			,						a__    ) ->      Any:






            '''simple docstring'''





            __snake_case       , __snake_case       , __snake_case       , __snake_case			:Optional[Any]          =						hidden_states.shape
            __snake_case			:Optional[Any]          =						jax.image.resize(
                a__			,						shape=(batch, height * 2, width * 2, channels)			,						method="""nearest"""			,						)
            __snake_case			:Optional[int]          =						self.conv(a__    )
            return hidden_states




class 			snake_case__   (							nn.Module):

       '''simple docstring'''
       lowerCamelCase							:				int
       lowerCamelCase							:				jnp.dtype 				= jnp.floataa



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






            '''simple docstring'''





            __snake_case			:List[str]          =						nn.Conv(
                self.out_channels			,						kernel_size=(3, 3)			,						strides=(2, 2)			,						padding=((1, 1), (1, 1))			,						dtype=self.dtype			,						)



       def __call__(							self			,						a__    ) ->      Optional[int]:






            '''simple docstring'''





            __snake_case			:List[str]          =						self.conv(a__    )
            return hidden_states




class 			snake_case__   (							nn.Module):

       '''simple docstring'''
       lowerCamelCase							:				int
       lowerCamelCase							:				int 				= None
       lowerCamelCase							:				float 				= 0.0
       lowerCamelCase							:				bool 				= None
       lowerCamelCase							:				jnp.dtype 				= jnp.floataa



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






            '''simple docstring'''





            __snake_case			:Optional[int]          =						self.in_channels if self.out_channels is None else self.out_channels

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

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

            __snake_case			:List[str]          =						nn.GroupNorm(num_groups=32			,						epsilon=1e-5    )
            __snake_case			:int          =						nn.Dropout(self.dropout_prob    )
            __snake_case			:Dict          =						nn.Conv(
                a__			,						kernel_size=(3, 3)			,						strides=(1, 1)			,						padding=((1, 1), (1, 1))			,						dtype=self.dtype			,						)

            __snake_case			:Optional[int]          =						self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

            __snake_case			:Optional[int]          =						None
            if use_nin_shortcut:
                 __snake_case			:Any          =						nn.Conv(
                     a__			,						kernel_size=(1, 1)			,						strides=(1, 1)			,						padding="""VALID"""			,						dtype=self.dtype			,						)



       def __call__(							self			,						a__			,						a__			,						a__=True    ) ->      List[Any]:






            '''simple docstring'''





            __snake_case			:Any          =						hidden_states
            __snake_case			:List[Any]          =						self.norma(a__    )
            __snake_case			:str          =						nn.swish(a__    )
            __snake_case			:int          =						self.conva(a__    )

            __snake_case			:Optional[Any]          =						self.time_emb_proj(nn.swish(a__    )    )
            __snake_case			:Optional[int]          =						jnp.expand_dims(jnp.expand_dims(a__			,						1    )			,						1    )
            __snake_case			:Optional[Any]          =						hidden_states + temb

            __snake_case			:Tuple          =						self.norma(a__    )
            __snake_case			:int          =						nn.swish(a__    )
            __snake_case			:Any          =						self.dropout(a__			,						a__    )
            __snake_case			:Optional[Any]          =						self.conva(a__    )

            if self.conv_shortcut is not None:
                 __snake_case			:Union[str, Any]          =						self.conv_shortcut(a__    )

            return hidden_states + residual










def   UpperCamelCase  (       snake_case__     :   str  ):




     '''simple docstring'''






     __snake_case			:List[Any]          =						hex_num.strip()
     if not hex_num:
          raise ValueError("""No value was passed to the function"""  )

     __snake_case			:str          =						hex_num[0] == """-"""
     if is_negative:
          __snake_case			:List[Any]          =						hex_num[1:]

     try:
          __snake_case			:Tuple          =						int(snake_case__	,16  )
     except ValueError:
          raise ValueError("""Invalid value was passed to the function"""  )

     __snake_case			:int          =						""""""
     while int_num > 0:
          __snake_case			:Optional[int]          =						str(int_num % 2  ) + bin_str
          int_num >>= 1

     return int(("""-""" + bin_str) if is_negative else bin_str  )


if __name__ == "__main__":
     import doctest

     doctest.testmod()


