






'''simple docstring'''






import unittest

from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow


if is_flax_available():
      import jax

      from transformers.models.auto.modeling_flax_auto import FlaxAutoModel
      from transformers.models.bert.modeling_flax_bert import FlaxBertModel
      from transformers.models.roberta.modeling_flax_roberta import FlaxRobertaModel




@require_flax
class a_    (    unittest.TestCase							):







   @slow
   def     SCREAMING_SNAKE_CASE__					(self)			->      List[Any]:
      """simple docstring"""






      for model_name in ["bert-base-cased", "bert-large-uncased"]:
         with self.subTest(__a):
            __snake_case				:      int     							= AutoConfig.from_pretrained(__a)
            self.assertIsNotNone(__a)
            self.assertIsInstance(__a					,   __a)

            __snake_case				:      Any     							= FlaxAutoModel.from_pretrained(__a)
            self.assertIsNotNone(__a)
            self.assertIsInstance(__a					,   __a)







   @slow
   def     SCREAMING_SNAKE_CASE__					(self)			->      Optional[Any]:
      """simple docstring"""






      for model_name in ["roberta-base", "roberta-large"]:
         with self.subTest(__a):
            __snake_case				:      Union[str, Any]     							= AutoConfig.from_pretrained(__a)
            self.assertIsNotNone(__a)
            self.assertIsInstance(__a					,   __a)

            __snake_case				:      Union[str, Any]     							= FlaxAutoModel.from_pretrained(__a)
            self.assertIsNotNone(__a)
            self.assertIsInstance(__a					,   __a)







   @slow
   def     SCREAMING_SNAKE_CASE__					(self)			->      Optional[int]:
      """simple docstring"""






      for model_name in ["bert-base-cased", "bert-large-uncased"]:
         __snake_case				:      Optional[int]     							= AutoTokenizer.from_pretrained(__a)
         __snake_case				:      Optional[int]     							= FlaxBertModel.from_pretrained(__a)
         __snake_case				:      Optional[int]     							= tokenizer('Do you support jax jitted function?'					,   return_tensors=TensorType.JAX)

         @jax.jit
         def eval(**__a):
            return model(**__a)

         eval(**__a).block_until_ready()







   @slow
   def     SCREAMING_SNAKE_CASE__					(self)			->      int:
      """simple docstring"""






      for model_name in ["roberta-base", "roberta-large"]:
         __snake_case				:      Optional[Any]     							= AutoTokenizer.from_pretrained(__a)
         __snake_case				:      List[Any]     							= FlaxRobertaModel.from_pretrained(__a)
         __snake_case				:      Any     							= tokenizer('Do you support jax jitted function?'					,   return_tensors=TensorType.JAX)

         @jax.jit
         def eval(**__a):
            return model(**__a)

         eval(**__a).block_until_ready()







   def     SCREAMING_SNAKE_CASE__					(self)			->      str:
      """simple docstring"""






      with self.assertRaisesRegex(
          __a					,   'bert-base is not a local folder and is not a valid model identifier'):
         __snake_case				:      List[str]     							= FlaxAutoModel.from_pretrained('bert-base')







   def     SCREAMING_SNAKE_CASE__					(self)			->      Any:
      """simple docstring"""






      with self.assertRaisesRegex(
          __a					,   R'aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)'):
         __snake_case				:      Dict     							= FlaxAutoModel.from_pretrained(__a					,   revision='aaaaaa')







   def     SCREAMING_SNAKE_CASE__					(self)			->      List[Any]:
      """simple docstring"""






      with self.assertRaisesRegex(
          __a					,   'hf-internal-testing/config-no-model does not appear to have a file named flax_model.msgpack'					,   ):
         __snake_case				:      int     							= FlaxAutoModel.from_pretrained('hf-internal-testing/config-no-model')







   def     SCREAMING_SNAKE_CASE__					(self)			->      Optional[Any]:
      """simple docstring"""






      with self.assertRaisesRegex(__a					,   'Use `from_pt=True` to load this model'):
         __snake_case				:      Optional[Any]     							= FlaxAutoModel.from_pretrained('hf-internal-testing/tiny-bert-pt-only')







'''simple docstring'''






import math




class a_    :







   def __init__(self					,   __a=0)			->      Any:  # a graph with Node 0,1,...,N-1
      """simple docstring"""






      __snake_case				:      List[str]     							= n
      __snake_case				:      Tuple     							= [
          [math.inf for j in range(0					,   __a)] for i in range(0					,   __a)
      ]  # adjacency matrix for weight
      __snake_case				:      Union[str, Any]     							= [
          [math.inf for j in range(0					,   __a)] for i in range(0					,   __a)
      ]  # dp[i][j] stores minimum distance from i to j







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a)			->      Tuple:
      """simple docstring"""






      __snake_case				:      Union[str, Any]     							= w







   def     SCREAMING_SNAKE_CASE__					(self)			->      Tuple:
      """simple docstring"""






      for k in range(0					,   self.n):
         for i in range(0					,   self.n):
            for j in range(0					,   self.n):
               __snake_case				:      List[Any]     							= min(self.dp[i][j]					,   self.dp[i][k] + self.dp[k][j])







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a)			->      Optional[int]:
      """simple docstring"""






      return self.dp[u][v]


if __name__ == "__main__":
      __A    	=   Graph(5)
      graph.add_edge(0, 2, 9)
      graph.add_edge(0, 4, 1_0)
      graph.add_edge(1, 3, 5)
      graph.add_edge(2, 3, 7)
      graph.add_edge(3, 0, 1_0)
      graph.add_edge(3, 1, 2)
      graph.add_edge(3, 2, 1)
      graph.add_edge(3, 4, 6)
      graph.add_edge(4, 1, 3)
      graph.add_edge(4, 2, 4)
      graph.add_edge(4, 3, 9)
      graph.floyd_warshall()
      graph.show_min(1, 4)
      graph.show_min(0, 3)