



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

class    UpperCAmelCase_  (   nn.Module       ):

						'''simple docstring'''




						UpperCamelCase__			: int
						UpperCamelCase__			: jnp.dtype				  =  jnp.floataa






						def        _A	(    self		):







													'''simple docstring'''

													__SCREAMING_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      ,							_A		):







													'''simple docstring'''

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







class    UpperCAmelCase_  (   nn.Module       ):

						'''simple docstring'''




						UpperCamelCase__			: int
						UpperCamelCase__			: jnp.dtype				  =  jnp.floataa






						def        _A	(    self		):







													'''simple docstring'''

													__SCREAMING_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      ,							_A		):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE									=					self.conv(__lowercase		)
													return hidden_states







class    UpperCAmelCase_  (   nn.Module       ):

						'''simple docstring'''




						UpperCamelCase__			: int
						UpperCamelCase__			: int				  =  None
						UpperCamelCase__			: float				  =  0.0
						UpperCamelCase__			: bool				  =  None
						UpperCamelCase__			: jnp.dtype				  =  jnp.floataa






						def        _A	(    self		):







													'''simple docstring'''

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

													__SCREAMING_SNAKE_CASE									=					nn.GroupNorm(num_groups=32      ,							epsilon=1e-5		)
													__SCREAMING_SNAKE_CASE									=					nn.Conv(
													    __lowercase      ,							kernel_size=(3, 3)      ,							strides=(1, 1)      ,							padding=((1, 1), (1, 1))      ,							dtype=self.dtype      ,							)

													__SCREAMING_SNAKE_CASE									=					nn.Dense(__lowercase      ,							dtype=self.dtype		)

													__SCREAMING_SNAKE_CASE									=					nn.GroupNorm(num_groups=32      ,							epsilon=1e-5		)
													__SCREAMING_SNAKE_CASE									=					nn.Dropout(self.dropout_prob		)
													__SCREAMING_SNAKE_CASE									=					nn.Conv(
													    __lowercase      ,							kernel_size=(3, 3)      ,							strides=(1, 1)      ,							padding=((1, 1), (1, 1))      ,							dtype=self.dtype      ,							)

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

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






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







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE									=					hidden_states
													__SCREAMING_SNAKE_CASE									=					self.norma(__lowercase		)
													__SCREAMING_SNAKE_CASE									=					nn.swish(__lowercase		)
													__SCREAMING_SNAKE_CASE									=					self.conva(__lowercase		)

													__SCREAMING_SNAKE_CASE									=					self.time_emb_proj(nn.swish(__lowercase		)		)
													__SCREAMING_SNAKE_CASE									=					jnp.expand_dims(jnp.expand_dims(__lowercase      ,							1		)      ,							1		)
													__SCREAMING_SNAKE_CASE									=					hidden_states + temb

													__SCREAMING_SNAKE_CASE									=					self.norma(__lowercase		)
													__SCREAMING_SNAKE_CASE									=					nn.swish(__lowercase		)
													__SCREAMING_SNAKE_CASE									=					self.dropout(__lowercase      ,							__lowercase		)
													__SCREAMING_SNAKE_CASE									=					self.conva(__lowercase		)

													if self.conv_shortcut is not None:
																				__SCREAMING_SNAKE_CASE									=					self.conv_shortcut(__lowercase		)

													return hidden_states + residual














from abc import ABC, abstractmethod
from typing import Optional, Union

from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit
from ..utils.typing import NestedDataStructureLike, PathLike
class     a    ( lowercase__   ):



      """simple docstring"""


      def __init__(      self					:			Any		,      __lowercase					:			Optional[NestedDataStructureLike[PathLike]] = None		,      __lowercase					:			Optional[NamedSplit] = None		,      __lowercase					:			Optional[Features] = None		,      __lowercase					:			str = None		,      __lowercase					:			bool = False		,      __lowercase					:			bool = False		,      __lowercase					:			Optional[int] = None		,      **__lowercase					:			List[str]		,      )							->      Tuple:
        __UpperCAmelCase							:	Any           =  path_or_paths
        __UpperCAmelCase							:	Dict           =  split if split or isinstance(__lowercase		,      __lowercase					) else """train"""
        __UpperCAmelCase							:	Optional[int]           =  features
        __UpperCAmelCase							:	str           =  cache_dir
        __UpperCAmelCase							:	str           =  keep_in_memory
        __UpperCAmelCase							:	Optional[int]           =  streaming
        __UpperCAmelCase							:	Dict           =  num_proc
        __UpperCAmelCase							:	Tuple           =  kwargs




      @abstractmethod
      def 	UpperCAmelCase      (      self					:			List[Any]					)							->      Union[Dataset, DatasetDict, IterableDataset, IterableDatasetDict]:
        pass


class     a    ( lowercase__   ):



      """simple docstring"""


      def __init__(      self					:			List[str]		,      __lowercase					:			Optional[Features] = None		,      __lowercase					:			str = None		,      __lowercase					:			bool = False		,      __lowercase					:			bool = False		,      __lowercase					:			Optional[int] = None		,      **__lowercase					:			Optional[Any]		,      )							->      Optional[int]:
        __UpperCAmelCase							:	Optional[Any]           =  features
        __UpperCAmelCase							:	str           =  cache_dir
        __UpperCAmelCase							:	Optional[int]           =  keep_in_memory
        __UpperCAmelCase							:	Dict           =  streaming
        __UpperCAmelCase							:	Optional[Any]           =  num_proc
        __UpperCAmelCase							:	Union[str, Any]           =  kwargs




      @abstractmethod
      def 	UpperCAmelCase      (      self					:			List[str]					)							->      Union[Dataset, IterableDataset]:
        pass


