





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







class   __lowerCAmelCase			(					nn.Module  ):
   _UpperCamelCase :						int
   _UpperCamelCase :						jnp.dtype     		=				jnp.floataa





   def 	_snake_case ( self      )				->  Any:
      """simple docstring"""





      a__	:						Dict      		=  nn.Conv(
          self.out_channels					,			kernel_size=(3, 3)					,			strides=(1, 1)					,			padding=((1, 1), (1, 1))					,			dtype=self.dtype					,			)





   def __call__( self					,			snake_case      )				->  str:
      """simple docstring"""





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







class   __lowerCAmelCase			(					nn.Module  ):
   _UpperCamelCase :						int
   _UpperCamelCase :						jnp.dtype     		=				jnp.floataa





   def 	_snake_case ( self      )				->  List[str]:
      """simple docstring"""





      a__	:						Optional[int]      		=  nn.Conv(
          self.out_channels					,			kernel_size=(3, 3)					,			strides=(2, 2)					,			padding=((1, 1), (1, 1))					,			dtype=self.dtype					,			)





   def __call__( self					,			snake_case      )				->  Union[str, Any]:
      """simple docstring"""





      a__	:						str      		=  self.conv(snake_case      )
      return hidden_states







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





   def 	_snake_case ( self      )				->  Dict:
      """simple docstring"""





      a__	:						Tuple      		=  self.in_channels if self.out_channels is None else self.out_channels

      a__	:						Optional[int]      		=  nn.GroupNorm(num_groups=32					,			epsilon=1E-5      )
      a__	:						Tuple      		=  nn.Conv(
          snake_case					,			kernel_size=(3, 3)					,			strides=(1, 1)					,			padding=((1, 1), (1, 1))					,			dtype=self.dtype					,			)

      a__	:						Optional[Any]      		=  nn.Dense(snake_case					,			dtype=self.dtype      )

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

      a__	:						Dict      		=  self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

      a__	:						Any      		=  None
      if use_nin_shortcut:
         a__	:						Any      		=  nn.Conv(
             snake_case					,			kernel_size=(1, 1)					,			strides=(1, 1)					,			padding="VALID"					,			dtype=self.dtype					,			)





   def __call__( self					,			snake_case					,			snake_case					,			snake_case=True      )				->  str:
      """simple docstring"""





      a__	:						Tuple      		=  hidden_states
      a__	:						List[Any]      		=  self.norma(snake_case      )
      a__	:						List[Any]      		=  nn.swish(snake_case      )
      a__	:						List[Any]      		=  self.conva(snake_case      )

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

      a__	:						Dict      		=  self.norma(snake_case      )
      a__	:						Tuple      		=  nn.swish(snake_case      )
      a__	:						Dict      		=  self.dropout(snake_case					,			snake_case      )
      a__	:						str      		=  self.conva(snake_case      )

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

      return hidden_states + residual








SCREAMING_SNAKE_CASE__       :			Union[str, Any]			      =						9.80665






def       _A  (      lowerCamelCase							, lowerCamelCase							, lowerCamelCase = g   ):

   if fluid_density <= 0:
      raise ValueError("Impossible fluid density"   )
   if volume < 0:
      raise ValueError("Impossible Object volume"   )
   if gravity <= 0:
      raise ValueError("Impossible Gravity"   )

   return fluid_density * gravity * volume


if __name__ == "__main__":
  import doctest

  # run doctest
  doctest.testmod()

