





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

import numpy as np

def 		_SCREAMING_SNAKE_CASE			(_UpperCAmelCase					:    Callable  ,     _UpperCAmelCase					:    float  ,     _UpperCAmelCase					:    float  ,     _UpperCAmelCase					:    float  ,     _UpperCAmelCase					:    float			):
 lowerCAmelCase    				= int(np.ceil((x_end - xa) / step_size			)			)
 lowerCAmelCase    				= np.zeros((n + 1,)			)
 lowerCAmelCase    				= ya
 lowerCAmelCase    				= xa

 for k in range(_UpperCAmelCase			):
  lowerCAmelCase    				= y[k] + step_size * ode_func(_UpperCAmelCase  ,     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 						a__		( unittest.TestCase		):
   @slow
   def      __magic_name__     (     self							):
          lowercase       :							Tuple									=				AutoModelForSeqaSeqLM.from_pretrained("google/mt5-small"      ,       return_dict=_a							).to(_a							)
          lowercase       :							Union[str, Any]									=				AutoTokenizer.from_pretrained("google/mt5-small"							)

          lowercase       :							Optional[Any]									=				tokenizer("Hello there"      ,       return_tensors="pt"							).input_ids
          lowercase       :							Union[str, Any]									=				tokenizer("Hi I am"      ,       return_tensors="pt"							).input_ids

          lowercase       :							int									=				model(input_ids.to(_a							)      ,       labels=labels.to(_a							)							).loss
          lowercase       :							str									=				-(labels.shape[-1] * loss.item())

          lowercase       :							List[str]									=				-8_4.9_1_2_7
          self.assertTrue(abs(mtf_score - EXPECTED_SCORE							) < 1E-4							)


