

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







class 				lowercase       ( nn.Module    ):
				__SCREAMING_SNAKE_CASE      :				int
				__SCREAMING_SNAKE_CASE      :				jnp.dtype     =    jnp.floataa




				def 					a							(      self ):
											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   ,     snake_case ):
											snake_case_       ,					snake_case_       ,					snake_case_       ,					snake_case_           =					hidden_states.shape
											snake_case_           =					jax.image.resize(
											    snake_case   ,     shape=(batch, height * 2, width * 2, channels)   ,     method='nearest'   ,     )
											snake_case_           =					self.conv(snake_case )
											return hidden_states







class 				lowercase       ( nn.Module    ):
				__SCREAMING_SNAKE_CASE      :				int
				__SCREAMING_SNAKE_CASE      :				jnp.dtype     =    jnp.floataa




				def 					a							(      self ):
											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   ,     snake_case ):
											# pad = ((0, 0), (0, 1), (0, 1), (0, 0))  # pad height and width dim
											# hidden_states = jnp.pad(hidden_states, pad_width=pad)
											snake_case_           =					self.conv(snake_case )
											return hidden_states







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




				def 					a							(      self ):
											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(
											    snake_case   ,     kernel_size=(3, 3)   ,     strides=(1, 1)   ,     padding=((1, 1), (1, 1))   ,     dtype=self.dtype   ,     )

											snake_case_           =					nn.Dense(snake_case   ,     dtype=self.dtype )

											snake_case_           =					nn.GroupNorm(num_groups=32   ,     epsilon=1e-5 )
											snake_case_           =					nn.Dropout(self.dropout_prob )
											snake_case_           =					nn.Conv(
											    snake_case   ,     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(
																		    snake_case   ,     kernel_size=(1, 1)   ,     strides=(1, 1)   ,     padding='VALID'   ,     dtype=self.dtype   ,     )




				def __call__(      self   ,     snake_case   ,     snake_case   ,     snake_case=True ):
											snake_case_           =					hidden_states
											snake_case_           =					self.norma(snake_case )
											snake_case_           =					nn.swish(snake_case )
											snake_case_           =					self.conva(snake_case )

											snake_case_           =					self.time_emb_proj(nn.swish(snake_case ) )
											snake_case_           =					jnp.expand_dims(jnp.expand_dims(snake_case   ,     1 )   ,     1 )
											snake_case_           =					hidden_states + temb

											snake_case_           =					self.norma(snake_case )
											snake_case_           =					nn.swish(snake_case )
											snake_case_           =					self.dropout(snake_case   ,     snake_case )
											snake_case_           =					self.conva(snake_case )

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

											return hidden_states + residual







import warnings

from ...utils import logging
from .image_processing_deformable_detr import DeformableDetrImageProcessor


_UpperCAmelCase	:     Any		       = logging.get_logger(__name__)







class 				lowercase       ( lowercase_    ):




				def __init__(      self   ,     *snake_case   ,     **snake_case ):
											warnings.warn(
											    'The class DeformableDetrFeatureExtractor is deprecated and will be removed in version 5 of Transformers.'
											    ' Please use DeformableDetrImageProcessor instead.'   ,     snake_case   ,     )
											super().__init__(*snake_case   ,     **snake_case )




