

"""simple docstring"""
from collections.abc import Callable

import numpy as np




def 					a__						(						lowerCAmelCase			,	lowerCAmelCase			,	lowerCAmelCase			,	lowerCAmelCase			,	lowerCAmelCase    )	-> np.ndarray:
      UpperCAmelCase__			:							str							=    int(np.ceil((x_end - xa) / step_size    )    )
      UpperCAmelCase__			:							List[Any]							=    np.zeros((n + 1,)    )
      UpperCAmelCase__			:							Any							=    ya
      UpperCAmelCase__			:							Dict							=    xa

      for k in range(lowerCAmelCase    ):
            UpperCAmelCase__			:							Optional[int]							=    y[k] + step_size * ode_func(lowerCAmelCase			,	y[k]    )
            x += step_size

      return y


if __name__ == "__main__":
    import doctest

    doctest.testmod()




"""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       lowerCamelCase	(       unittest.TestCase   ):


  '''simple docstring'''







  @slow
  def  _a      (self	):


        """simple docstring"""

        UpperCAmelCase__			:							Dict							=    AutoModelForSeqaSeqLM.from_pretrained("""google/mt5-small"""							,       return_dict=_lowerCamelCase	).to(_lowerCamelCase	)
        UpperCAmelCase__			:							Optional[Any]							=    AutoTokenizer.from_pretrained("""google/mt5-small"""	)

        UpperCAmelCase__			:							Any							=    tokenizer("""Hello there"""							,       return_tensors="""pt"""	).input_ids
        UpperCAmelCase__			:							str							=    tokenizer("""Hi I am"""							,       return_tensors="""pt"""	).input_ids

        UpperCAmelCase__			:							Tuple							=    model(input_ids.to(_lowerCamelCase	)							,       labels=labels.to(_lowerCamelCase	)	).loss
        UpperCAmelCase__			:							Union[str, Any]							=    -(labels.shape[-1] * loss.item())

        UpperCAmelCase__			:							List[str]							=    -84.9_127
        self.assertTrue(abs(mtf_score - EXPECTED_SCORE	) < 1e-4	)

