

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


lowerCamelCase           =					logging.get_logger(__name__)

lowerCamelCase           =					{
    '''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 						__magic_name__			(							lowerCamelCase__							):

   '''simple docstring'''




   lowerCamelCase__ :	Optional[int]    =   'decision_transformer'
   lowerCamelCase__ :	Tuple    =   ['past_key_values']
   lowerCamelCase__ :	Any    =   {
       'max_position_embeddings': 'n_positions',
       'num_attention_heads': 'n_head',
       'num_hidden_layers': 'n_layer',
   }



   def __init__(				self,    lowercase_=17,    lowercase_=4,    lowercase_=128,    lowercase_=4096,    lowercase_=True,    lowercase_=1,    lowercase_=1024,    lowercase_=3,    lowercase_=1,    lowercase_=None,    lowercase_="relu",    lowercase_=0.1,    lowercase_=0.1,    lowercase_=0.1,    lowercase_=1E-5,    lowercase_=0.02,    lowercase_=True,    lowercase_=True,    lowercase_=50256,    lowercase_=50256,    lowercase_=False,    lowercase_=False,    **lowercase_,    )							->    Union[str, Any]:






     """simple docstring"""






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

     a__  =bos_token_id
     a__  =eos_token_id

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



import os




def 			UpperCAmelCase__				(			_A      : Any							):





  '''simple docstring'''







  a__  =len(grid[0]							)
  a__  =len(_A							)

  a__  =0
  a__  =0
  a__  =0

  # Check vertically, horizontally, diagonally at the same time (only works
  # for nxn grid)
  for i in range(_A							):
    for j in range(n_rows - 3							):
      a__  =grid[j][i] * grid[j + 1][i] * grid[j + 2][i] * grid[j + 3][i]
      a__  =grid[i][j] * grid[i][j + 1] * grid[i][j + 2] * grid[i][j + 3]

      # Left-to-right diagonal (\) product
      if i < n_columns - 3:
        a__  =(
            grid[i][j]
            * grid[i + 1][j + 1]
            * grid[i + 2][j + 2]
            * grid[i + 3][j + 3]
        )

      # Right-to-left diagonal(/) product
      if i > 2:
        a__  =(
            grid[i][j]
            * grid[i - 1][j + 1]
            * grid[i - 2][j + 2]
            * grid[i - 3][j + 3]
        )

      a__  =max(
          _A	,      _A	,      _A	,      _A							)
      if max_product > largest:
        a__  =max_product

  return largest




def 			UpperCAmelCase__				(			):





  '''simple docstring'''







  a__  =[]
  with open(os.path.dirname(_A							) + '''/grid.txt'''							) as file:
    for line in file:
      grid.append(line.strip('''\n'''							).split(''' '''							)							)

  a__  =[[int(_A							) for i in grid[j]] for j in range(len(_A							)							)]

  return largest_product(_A							)


if __name__ == "__main__":
       print(solution())
