






'''simple docstring'''



from random import randint, random



def    __UpperCAmelCase	(				SCREAMING_SNAKE_CASE__:	int,					SCREAMING_SNAKE_CASE__:	int,					SCREAMING_SNAKE_CASE__:	int,					SCREAMING_SNAKE_CASE__:	bool = False,					SCREAMING_SNAKE_CASE__:	bool = False,					SCREAMING_SNAKE_CASE__:	int = 5,					)  ->			list:

   """simple docstring"""
   __a				     =    [[-1] * number_of_cells]  # Create a highway without any car
   __a				     =    0
   __a				     =    max(SCREAMING_SNAKE_CASE__,					0    )
   while i < number_of_cells:
      __a				     =    (
          randint(0,					SCREAMING_SNAKE_CASE__    ) if random_speed else initial_speed
      )  # Place the cars
      i += (
          randint(1,					max_speed * 2    ) if random_frequency else frequency
      )  # Arbitrary number, may need tuning
   return highway



def    __UpperCAmelCase	(				SCREAMING_SNAKE_CASE__:	list,					SCREAMING_SNAKE_CASE__:	int    )  ->			int:

   """simple docstring"""
   __a				     =    0
   __a				     =    highway_now[car_index + 1 :]
   for cell in range(len(SCREAMING_SNAKE_CASE__    )    ):  # May need a better name for this
      if cells[cell] != -1:  # If the cell is not empty then
         return distance  # we have the distance we wanted
      distance += 1
   # Here if the car is near the end of the highway
   return distance + get_distance(SCREAMING_SNAKE_CASE__,					-1    )



def    __UpperCAmelCase	(				SCREAMING_SNAKE_CASE__:	list,					SCREAMING_SNAKE_CASE__:	float,					SCREAMING_SNAKE_CASE__:	int    )  ->			list:

   """simple docstring"""
   __a				     =    len(SCREAMING_SNAKE_CASE__    )
   # Beforce calculations, the highway is empty
   __a				     =    [-1] * number_of_cells

   for car_index in range(SCREAMING_SNAKE_CASE__    ):
      if highway_now[car_index] != -1:
         # Add 1 to the current speed of the car and cap the speed
         __a				     =    min(highway_now[car_index] + 1,					SCREAMING_SNAKE_CASE__    )
         # Number of empty cell before the next car
         __a				     =    get_distance(SCREAMING_SNAKE_CASE__,					SCREAMING_SNAKE_CASE__    ) - 1
         # We can't have the car causing an accident
         __a				     =    min(next_highway[car_index],					SCREAMING_SNAKE_CASE__    )
         if random() < probability:
            # Randomly, a driver will slow down
            __a				     =    max(next_highway[car_index] - 1,					0    )
   return next_highway



def    __UpperCAmelCase	(				SCREAMING_SNAKE_CASE__:	list,					SCREAMING_SNAKE_CASE__:	int,					SCREAMING_SNAKE_CASE__:	float,					SCREAMING_SNAKE_CASE__:	int    )  ->			list:

   """simple docstring"""
   __a				     =    len(highway[0]    )

   for i in range(SCREAMING_SNAKE_CASE__    ):
      __a				     =    update(highway[i],					SCREAMING_SNAKE_CASE__,					SCREAMING_SNAKE_CASE__    )
      __a				     =    [-1] * number_of_cells

      for car_index in range(SCREAMING_SNAKE_CASE__    ):
         __a				     =    next_speeds_calculated[car_index]
         if speed != -1:
            # Change the position based on the speed (with % to create the loop)
            __a				     =    (car_index + speed) % number_of_cells
            # Commit the change of position
            __a				     =    speed
      highway.append(SCREAMING_SNAKE_CASE__    )

   return highway


if __name__ == "__main__":
 import doctest

 doctest.testmod()







'''simple docstring'''



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


__UpperCamelCase      :       Dict      			=      logging.get_logger(__name__)

__UpperCamelCase      :       Any      			=      {
    """google/vivit-b-16x2-kinetics400""": (
        """https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json"""
    ),
    # See all Vivit models at https://huggingface.co/models?filter=vivit
}
class 							__SCREAMING_SNAKE_CASE       (							_lowerCAmelCase     ):
      __a  					="vivit"




      def __init__(  self ,   lowerCamelCase=224 ,   lowerCamelCase=32 ,   lowerCamelCase=[2, 16, 16] ,   lowerCamelCase=3 ,   lowerCamelCase=768 ,   lowerCamelCase=12 ,   lowerCamelCase=12 ,   lowerCamelCase=3072 ,   lowerCamelCase="gelu_fast" ,   lowerCamelCase=0.0 ,   lowerCamelCase=0.0 ,   lowerCamelCase=0.02 ,   lowerCamelCase=1e-06 ,   lowerCamelCase=True ,   **lowerCamelCase ,   )							->Tuple:



         '''simple docstring'''
         __a				     =    hidden_size
         __a				     =    num_hidden_layers
         __a				     =    num_attention_heads
         __a				     =    intermediate_size
         __a				     =    hidden_act
         __a				     =    hidden_dropout_prob
         __a				     =    attention_probs_dropout_prob
         __a				     =    initializer_range
         __a				     =    layer_norm_eps

         __a				     =    image_size
         __a				     =    num_frames
         __a				     =    tubelet_size
         __a				     =    num_channels
         __a				     =    qkv_bias

         super().__init__(**lowerCamelCase      )