




import flax.linen as nn
import jax
import jax.numpy as jnp
class       a__   ( nn.Module				):
						_a							:   int
						_a							:   jnp.dtype =   jnp.floataa






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



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






						def __call__(       self		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase       ,							__lowerCAmelCase       ,							__lowerCAmelCase       ,							__lowerCAmelCase           =	hidden_states.shape
											__lowerCAmelCase           =	jax.image.resize(
											    _A		,      shape=(batch, height * 2, width * 2, channels)		,      method="nearest"		,      )
											__lowerCAmelCase           =	self.conv(_A      )
											return hidden_states






class       a__   ( nn.Module				):
						_a							:   int
						_a							:   jnp.dtype =   jnp.floataa






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



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






						def __call__(       self		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.conv(_A      )
											return hidden_states






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






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



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

											__lowerCAmelCase           =	nn.GroupNorm(num_groups=3_2		,      epsilon=1E-5      )
											__lowerCAmelCase           =	nn.Conv(
											    _A		,      kernel_size=(3, 3)		,      strides=(1, 1)		,      padding=((1, 1), (1, 1))		,      dtype=self.dtype		,      )

											__lowerCAmelCase           =	nn.Dense(_A		,      dtype=self.dtype      )

											__lowerCAmelCase           =	nn.GroupNorm(num_groups=3_2		,      epsilon=1E-5      )
											__lowerCAmelCase           =	nn.Dropout(self.dropout_prob      )
											__lowerCAmelCase           =	nn.Conv(
											    _A		,      kernel_size=(3, 3)		,      strides=(1, 1)		,      padding=((1, 1), (1, 1))		,      dtype=self.dtype		,      )

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

											__lowerCAmelCase           =	None
											if use_nin_shortcut:
																__lowerCAmelCase           =	nn.Conv(
																    _A		,      kernel_size=(1, 1)		,      strides=(1, 1)		,      padding="VALID"		,      dtype=self.dtype		,      )






						def __call__(       self		,      _A		,      _A		,      _A=True      ):




											"""simple docstring"""



											__lowerCAmelCase           =	hidden_states
											__lowerCAmelCase           =	self.norma(_A      )
											__lowerCAmelCase           =	nn.swish(_A      )
											__lowerCAmelCase           =	self.conva(_A      )

											__lowerCAmelCase           =	self.time_emb_proj(nn.swish(_A      )      )
											__lowerCAmelCase           =	jnp.expand_dims(jnp.expand_dims(_A		,      1      )		,      1      )
											__lowerCAmelCase           =	hidden_states + temb

											__lowerCAmelCase           =	self.norma(_A      )
											__lowerCAmelCase           =	nn.swish(_A      )
											__lowerCAmelCase           =	self.dropout(_A		,      _A      )
											__lowerCAmelCase           =	self.conva(_A      )

											if self.conv_shortcut is not None:
																__lowerCAmelCase           =	self.conv_shortcut(_A      )

											return hidden_states + residual










import enum
import shutil
import sys


UpperCamelCase__      ,     UpperCamelCase__         =      shutil.get_terminal_size()

UpperCamelCase__         =      {"""UP""": """A""", """DOWN""": """B""", """RIGHT""": """C""", """LEFT""": """D"""}
class       a__   ( enum.Enum				):
						_a							:   Any =   0
						_a							:   Dict =   1







def      _a				(						SCREAMING_SNAKE_CASE_							:    Tuple				,				SCREAMING_SNAKE_CASE_							:    Dict=""					):
					sys.stdout.write(str(SCREAMING_SNAKE_CASE_					) + end					)
					sys.stdout.flush()







def      _a				(						SCREAMING_SNAKE_CASE_							:    Any				,				SCREAMING_SNAKE_CASE_							:    Union[str, Any]				,				SCREAMING_SNAKE_CASE_							:    str=""					):
					forceWrite(F"""\u001b[{color}m{content}\u001b[0m"""				,				SCREAMING_SNAKE_CASE_					)







def      _a				(						):
					forceWrite("\r"					)







def      _a				(						SCREAMING_SNAKE_CASE_							:    int				,				SCREAMING_SNAKE_CASE_							:    str					):
					forceWrite(F"""\033[{num_lines}{CURSOR_TO_CHAR[direction.upper()]}"""					)







def      _a				(						):
					forceWrite(" " * TERMINAL_WIDTH					)
					reset_cursor()







def      _a				(						):
					reset_cursor()
					forceWrite("-" * TERMINAL_WIDTH					)




