






import functools
import operator

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


UpperCAmelCase__				   =		logging.get_logger(__name__)

UpperCAmelCase__				   =		{
    "microsoft/wavlm-base": "https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json",
    # See all WavLM models at https://huggingface.co/models?filter=wavlm
}






class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      __snake_case       =  '''wavlm'''







      def __init__(      self      :						str ,					__UpperCAmelCase      :						Optional[int]=32 ,					__UpperCAmelCase      :						Dict=768 ,					__UpperCAmelCase      :						Any=12 ,					__UpperCAmelCase      :						Union[str, Any]=12 ,					__UpperCAmelCase      :						Any=3_072 ,					__UpperCAmelCase      :						List[Any]="gelu" ,					__UpperCAmelCase      :						str=0.1 ,					__UpperCAmelCase      :						int=0.1 ,					__UpperCAmelCase      :						Optional[int]=0.1 ,					__UpperCAmelCase      :						Any=0.0 ,					__UpperCAmelCase      :						Optional[Any]=0.1 ,					__UpperCAmelCase      :						List[Any]=0.1 ,					__UpperCAmelCase      :						Optional[Any]=0.02 ,					__UpperCAmelCase      :						Tuple=1e-5 ,					__UpperCAmelCase      :						Dict="group" ,					__UpperCAmelCase      :						Optional[int]="gelu" ,					__UpperCAmelCase      :						Optional[Any]=(512, 512, 512, 512, 512, 512, 512) ,					__UpperCAmelCase      :						Any=(5, 2, 2, 2, 2, 2, 2) ,					__UpperCAmelCase      :						Tuple=(10, 3, 3, 3, 3, 2, 2) ,					__UpperCAmelCase      :						Any=False ,					__UpperCAmelCase      :						List[Any]=128 ,					__UpperCAmelCase      :						Tuple=16 ,					__UpperCAmelCase      :						str=320 ,					__UpperCAmelCase      :						List[Any]=800 ,					__UpperCAmelCase      :						Optional[Any]=False ,					__UpperCAmelCase      :						Optional[int]=True ,					__UpperCAmelCase      :						Dict=0.05 ,					__UpperCAmelCase      :						Union[str, Any]=10 ,					__UpperCAmelCase      :						Optional[int]=2 ,					__UpperCAmelCase      :						Dict=0.0 ,					__UpperCAmelCase      :						Any=10 ,					__UpperCAmelCase      :						Union[str, Any]=320 ,					__UpperCAmelCase      :						str=2 ,					__UpperCAmelCase      :						Any=0.1 ,					__UpperCAmelCase      :						Union[str, Any]=100 ,					__UpperCAmelCase      :						str=256 ,					__UpperCAmelCase      :						Any=256 ,					__UpperCAmelCase      :						Any=0.1 ,					__UpperCAmelCase      :						Union[str, Any]="mean" ,					__UpperCAmelCase      :						Tuple=False ,					__UpperCAmelCase      :						Optional[Any]=False ,					__UpperCAmelCase      :						List[Any]=256 ,					__UpperCAmelCase      :						Optional[int]=(512, 512, 512, 512, 1_500) ,					__UpperCAmelCase      :						Any=(5, 3, 3, 1, 1) ,					__UpperCAmelCase      :						Dict=(1, 2, 3, 1, 1) ,					__UpperCAmelCase      :						Optional[int]=512 ,					__UpperCAmelCase      :						Optional[Any]=80 ,					__UpperCAmelCase      :						Tuple=0 ,					__UpperCAmelCase      :						Union[str, Any]=1 ,					__UpperCAmelCase      :						Union[str, Any]=2 ,					__UpperCAmelCase      :						List[Any]=False ,					__UpperCAmelCase      :						List[str]=3 ,					__UpperCAmelCase      :						Union[str, Any]=2 ,					__UpperCAmelCase      :						Optional[Any]=3 ,					__UpperCAmelCase      :						str=None ,					**__UpperCAmelCase      :						Dict ,					)    ->Dict:




       """simple docstring"""


       super().__init__(**__UpperCAmelCase ,					pad_token_id=__UpperCAmelCase ,					bos_token_id=__UpperCAmelCase ,					eos_token_id=__UpperCAmelCase  )
       a		  =      hidden_size
       a		  =      feat_extract_norm
       a		  =      feat_extract_activation
       a		  =      list(__UpperCAmelCase  )
       a		  =      list(__UpperCAmelCase  )
       a		  =      list(__UpperCAmelCase  )
       a		  =      conv_bias
       a		  =      num_buckets
       a		  =      max_bucket_distance
       a		  =      num_conv_pos_embeddings
       a		  =      num_conv_pos_embedding_groups
       a		  =      len(self.conv_dim  )
       a		  =      num_hidden_layers
       a		  =      intermediate_size
       a		  =      hidden_act
       a		  =      num_attention_heads
       a		  =      hidden_dropout
       a		  =      attention_dropout
       a		  =      activation_dropout
       a		  =      feat_proj_dropout
       a		  =      final_dropout
       a		  =      layerdrop
       a		  =      layer_norm_eps
       a		  =      initializer_range
       a		  =      num_ctc_classes
       a		  =      vocab_size
       a		  =      do_stable_layer_norm
       a		  =      use_weighted_layer_sum
       a		  =      classifier_proj_size

       if (
           (len(self.conv_stride  ) != self.num_feat_extract_layers)
           or (len(self.conv_kernel  ) != self.num_feat_extract_layers)
           or (len(self.conv_dim  ) != self.num_feat_extract_layers)
       ):
        raise ValueError(
            '''Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =='''
            ''' `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ='''
            F""" {len(self.conv_dim  )}`, `len(config.conv_stride) = {len(self.conv_stride  )}`,"""
            F""" `len(config.conv_kernel) = {len(self.conv_kernel  )}`."""  )

       # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
       a		  =      apply_spec_augment
       a		  =      mask_time_prob
       a		  =      mask_time_length
       a		  =      mask_time_min_masks
       a		  =      mask_feature_prob
       a		  =      mask_feature_length

       # parameters for pretraining with codevector quantized representations
       a		  =      num_codevectors_per_group
       a		  =      num_codevector_groups
       a		  =      contrastive_logits_temperature
       a		  =      num_negatives
       a		  =      codevector_dim
       a		  =      proj_codevector_dim
       a		  =      diversity_loss_weight

       # ctc loss
       a		  =      ctc_loss_reduction
       a		  =      ctc_zero_infinity

       # adapter
       a		  =      add_adapter
       a		  =      adapter_kernel_size
       a		  =      adapter_stride
       a		  =      num_adapter_layers
       a		  =      output_hidden_size or hidden_size

       # SequenceClassification-specific parameter. Feel free to ignore for other classes.
       a		  =      classifier_proj_size

       # XVector-specific parameters. Feel free to ignore for other classes.
       a		  =      list(__UpperCAmelCase  )
       a		  =      list(__UpperCAmelCase  )
       a		  =      list(__UpperCAmelCase  )
       a		  =      xvector_output_dim







      @property
      def       __lowerCAmelCase					(      self      :						Union[str, Any]  )    ->Optional[int]:




       """simple docstring"""


       return functools.reduce(operator.mul ,					self.conv_stride ,					1  )










from __future__ import annotations

UpperCAmelCase__				   =		list[list[int]]

# assigning initial values to the grid
UpperCAmelCase__				   =		[
    [3, 0, 6, 5, 0, 8, 4, 0, 0],
    [5, 2, 0, 0, 0, 0, 0, 0, 0],
    [0, 8, 7, 0, 0, 0, 0, 3, 1],
    [0, 0, 3, 0, 1, 0, 0, 8, 0],
    [9, 0, 0, 8, 6, 3, 0, 0, 5],
    [0, 5, 0, 0, 9, 0, 6, 0, 0],
    [1, 3, 0, 0, 0, 0, 2, 5, 0],
    [0, 0, 0, 0, 0, 0, 0, 7, 4],
    [0, 0, 5, 2, 0, 6, 3, 0, 0],
]

# a grid with no solution
UpperCAmelCase__				   =		[
    [5, 0, 6, 5, 0, 8, 4, 0, 3],
    [5, 2, 0, 0, 0, 0, 0, 0, 2],
    [1, 8, 7, 0, 0, 0, 0, 3, 1],
    [0, 0, 3, 0, 1, 0, 0, 8, 0],
    [9, 0, 0, 8, 6, 3, 0, 0, 5],
    [0, 5, 0, 0, 9, 0, 6, 0, 0],
    [1, 3, 0, 0, 0, 0, 2, 5, 0],
    [0, 0, 0, 0, 0, 0, 0, 7, 4],
    [0, 0, 5, 2, 0, 6, 3, 0, 0],
]
def 						_a    (      a :Matrix	,							a :int	,							a :int	,							a :int )							->			bool:
 for i in range(9 ):
  if grid[row][i] == n or grid[i][column] == n:
   return False

 for i in range(3 ):
  for j in range(3 ):
   if grid[(row - row % 3) + i][(column - column % 3) + j] == n:
    return False

 return True
def 						_a    (      a :Matrix )							->			tuple[int, int] | None:
 for i in range(9 ):
  for j in range(9 ):
   if grid[i][j] == 0:
    return i, j
 return None
def 						_a    (      a :Matrix )							->			Matrix | None:
 if location := find_empty_location(a ):
  a  ,     a		  =      location
 else:
  # If the location is ``None``, then the grid is solved.
  return grid

 for digit in range(1	,							10 ):
  if is_safe(a	,							a	,							a	,							a ):
   a		  =      digit

   if sudoku(a ) is not None:
    return grid

   a		  =      0

 return None
def 						_a    (      a :Matrix )							->			None:
 for row in grid:
  for cell in row:
   print(a	,							end=''' ''' )
  print()


if __name__ == "__main__":
     # make a copy of grid so that you can compare with the unmodified grid
     for example_grid in (initial_grid, no_solution):
          print("\nExample grid:\n" + "=" * 20)
          print_solution(example_grid)
          print("\nExample grid solution:")
          UpperCAmelCase__				   =		sudoku(example_grid)
          if solution is not None:
               print_solution(solution)
          else:
               print("Cannot find a solution.")


