
"""simple docstring"""




import unittest

from transformers import load_tool
from transformers.utils import is_torch_available


if is_torch_available():
  import torch

from transformers.testing_utils import require_torch

from .test_tools_common import ToolTesterMixin


@require_torch
class 			__magic_name__       (       unittest.TestCase   ,					SCREAMING_SNAKE_CASE__ ):
       def 							lowercase_							(     self       )     ->	Any:





         """simple docstring"""




         _lowercase:			List[Any]       =     load_tool('''text-to-speech'''       )
         self.tool.setup()
       def 							lowercase_							(     self       )     ->	Tuple:





         """simple docstring"""




         torch.manual_seed(0       )
         _lowercase:			List[Any]       =     self.tool('''hey'''       )
         _lowercase:			Tuple       =     result.to_raw()
         self.assertTrue(
             torch.allclose(
                 resulting_tensor[:3] ,				torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85]       ) ,				)       )



       def 							lowercase_							(     self       )     ->	List[Any]:





         """simple docstring"""




         torch.manual_seed(0       )
         _lowercase:			List[str]       =     self.tool('''hey'''       )
         _lowercase:			Tuple       =     result.to_raw()
         self.assertTrue(
             torch.allclose(
                 resulting_tensor[:3] ,				torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85]       ) ,				)       )


"""simple docstring"""




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  if not isinstance(_UpperCamelCase ,				_UpperCamelCase						):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''						)
  if len(_UpperCamelCase						) == 0:
    raise ValueError('''Input list must be a non empty list'''						)
  if len(_UpperCamelCase						) == 1:
    return True
  _lowercase:			Any       =     series[1] - series[0]
  for index in range(len(_UpperCamelCase						) - 1						):
    if series[index + 1] - series[index] != common_diff:
      return False
  return True




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  if not isinstance(_UpperCamelCase ,				_UpperCamelCase						):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''						)
  if len(_UpperCamelCase						) == 0:
    raise ValueError('''Input list must be a non empty list'''						)
  _lowercase:			Tuple       =     0
  for val in series:
    answer += val
  return answer / len(_UpperCamelCase						)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
