






'''simple docstring'''





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




class 			_snake_case		(     nn.Module							):
			lowerCAmelCase_					:				int
			lowerCAmelCase_					:				jnp.dtype							=   jnp.floataa




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

										'''simple docstring'''




										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__							)    ->    List[str]:

										'''simple docstring'''




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




class 			_snake_case		(     nn.Module							):
			lowerCAmelCase_					:				int
			lowerCAmelCase_					:				jnp.dtype							=   jnp.floataa




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

										'''simple docstring'''




										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__							)    ->    Tuple:

										'''simple docstring'''




										snake_case_      =				self.conv(_A							)
										return hidden_states




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




			def        lowerCAmelCase__    ( self							)    ->    Union[str, Any]:

										'''simple docstring'''




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

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

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




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

										'''simple docstring'''




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

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

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

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

										return hidden_states + residual










'''simple docstring'''





from ...configuration_utils import PretrainedConfig
from ...utils import logging


_SCREAMING_SNAKE_CASE							:       List[Any]						=			logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE							:       Optional[int]						=			{
    "edbeeching/decision-transformer-gym-hopper-medium": (
        "https://huggingface.co/edbeeching/decision-transformer-gym-hopper-medium/resolve/main/config.json"
    ),
    # See all DecisionTransformer models at https://huggingface.co/models?filter=decision_transformer
}




class 			_snake_case		(     lowercase_							):
			lowerCAmelCase_					:				Dict							=   "decision_transformer"
			lowerCAmelCase_					:				List[Any]							=   ["past_key_values"]
			lowerCAmelCase_					:				Tuple							=   {
			    "max_position_embeddings": "n_positions",
			    "num_attention_heads": "n_head",
			    "num_hidden_layers": "n_layer",
			}




			def __init__( self    ,							a__=17    ,							a__=4    ,							a__=128    ,							a__=4_096    ,							a__=True    ,							a__=1    ,							a__=1_024    ,							a__=3    ,							a__=1    ,							a__=None    ,							a__="relu"    ,							a__=0.1    ,							a__=0.1    ,							a__=0.1    ,							a__=1e-5    ,							a__=0.0_2    ,							a__=True    ,							a__=True    ,							a__=50_256    ,							a__=50_256    ,							a__=False    ,							a__=False    ,							**a__    ,							)    ->    Optional[int]:

										'''simple docstring'''




										snake_case_      =				state_dim
										snake_case_      =				act_dim
										snake_case_      =				hidden_size
										snake_case_      =				max_ep_len
										snake_case_      =				action_tanh
										snake_case_      =				vocab_size
										snake_case_      =				n_positions
										snake_case_      =				n_layer
										snake_case_      =				n_head
										snake_case_      =				n_inner
										snake_case_      =				activation_function
										snake_case_      =				resid_pdrop
										snake_case_      =				embd_pdrop
										snake_case_      =				attn_pdrop
										snake_case_      =				layer_norm_epsilon
										snake_case_      =				initializer_range
										snake_case_      =				scale_attn_weights
										snake_case_      =				use_cache
										snake_case_      =				scale_attn_by_inverse_layer_idx
										snake_case_      =				reorder_and_upcast_attn

										snake_case_      =				bos_token_id
										snake_case_      =				eos_token_id

										super().__init__(bos_token_id=a__    ,							eos_token_id=a__    ,							**a__							)




