



'''simple docstring'''






import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
     from transformers import AutoModelForSeqaSeqLM, AutoTokenizer

@require_torch
@require_sentencepiece
@require_tokenizers
class 							a__( unittest.TestCase     ):







    @slow
    def       lowercase_	(				self			:  Optional[Any]     ):
      a						: Optional[Any]					       =					AutoModelForSeqaSeqLM.from_pretrained('google/mt5-small'						,      return_dict=__snake_case     ).to(__snake_case     )
      a						: Dict					       =					AutoTokenizer.from_pretrained('google/mt5-small'     )

      a						: List[Any]					       =					tokenizer('Hello there'						,      return_tensors='pt'     ).input_ids
      a						: Optional[int]					       =					tokenizer('Hi I am'						,      return_tensors='pt'     ).input_ids

      a						: List[str]					       =					model(input_ids.to(__snake_case     )						,      labels=labels.to(__snake_case     )     ).loss
      a						: Optional[int]					       =					-(labels.shape[-1] * loss.item())

      a						: List[Any]					       =					-84.9127
      self.assertTrue(abs(mtf_score - EXPECTED_SCORE     ) < 1e-4     )




'''simple docstring'''






import math

class 							a__:







    def __init__(				self			:  int						,      __snake_case			:  Any=0     ):  # a graph with Node 0,1,...,N-1
      a						: List[Any]					       =					n
      a						: Optional[Any]					       =					[
          [math.inf for j in range(0						,      __snake_case     )] for i in range(0						,      __snake_case     )
      ]  # adjacency matrix for weight
      a						: Dict					       =					[
          [math.inf for j in range(0						,      __snake_case     )] for i in range(0						,      __snake_case     )
      ]  # dp[i][j] stores minimum distance from i to j







    def       lowercase_	(				self			:  int						,      __snake_case			:  str						,      __snake_case			:  Tuple						,      __snake_case			:  int     ):
      a						: str					       =					w







    def       lowercase_	(				self			:  int     ):
      for k in range(0						,      self.n     ):
        for i in range(0						,      self.n     ):
          for j in range(0						,      self.n     ):
            a						: str					       =					min(self.dp[i][j]						,      self.dp[i][k] + self.dp[k][j]     )







    def       lowercase_	(				self			:  List[str]						,      __snake_case			:  Any						,      __snake_case			:  List[str]     ):
      return self.dp[u][v]


if __name__ == "__main__":
     lowerCAmelCase: Any							=						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)