





"""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 						__snake_case   (						unittest.TestCase				,				SCREAMING_SNAKE_CASE__	):





 """simple docstring"""


 def    UpperCamelCase__(       self    ):



     '''simple docstring'''




     __A       :		Any							=	load_tool('''text-to-speech'''    )
     self.tool.setup()

 def    UpperCamelCase__(       self    ):



     '''simple docstring'''




     torch.manual_seed(0    )
     __A       :		Optional[Any]							=	self.tool('''hey'''    )
     __A       :		Optional[Any]							=	result.to_raw()
     self.assertTrue(
         torch.allclose(
             resulting_tensor[:3]   ,		torch.tensor([-0.0_0_0_5_9_6_6_6_6_8_8_3_2_1_1_5_8_2_9, -0.0_0_0_3_6_5_7_6_4_0_1_9_0_7_9_5_0_6_4, -0.0_0_0_1_3_4_3_9_5_0_2_7_9_9_8_8_3_4_8_5]    )   ,		)    )







 def    UpperCamelCase__(       self    ):



     '''simple docstring'''




     torch.manual_seed(0    )
     __A       :		int							=	self.tool('''hey'''    )
     __A       :		Optional[int]							=	result.to_raw()
     self.assertTrue(
         torch.allclose(
             resulting_tensor[:3]   ,		torch.tensor([-0.0_0_0_5_9_6_6_6_6_8_8_3_2_1_1_5_8_2_9, -0.0_0_0_3_6_5_7_6_4_0_1_9_0_7_9_5_0_6_4, -0.0_0_0_1_3_4_3_9_5_0_2_7_9_9_8_8_3_4_8_5]    )   ,		)    )











"""simple docstring"""



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


a_					=     logging.get_logger(__name__)

a_					=     {
    """sail/poolformer_s12""": """https://huggingface.co/sail/poolformer_s12/resolve/main/config.json""",
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
}






class 						__snake_case   (						SCREAMING_SNAKE_CASE__	):





 """simple docstring"""


 _lowerCamelCase								=	"""poolformer"""

 def __init__(       self   ,		__lowerCamelCase=3   ,		__lowerCamelCase=16   ,		__lowerCamelCase=16   ,		__lowerCamelCase=3   ,		__lowerCamelCase=4.0   ,		__lowerCamelCase=[2, 2, 6, 2]   ,		__lowerCamelCase=[64, 128, 320, 512]   ,		__lowerCamelCase=[7, 3, 3, 3]   ,		__lowerCamelCase=[4, 2, 2, 2]   ,		__lowerCamelCase=[2, 1, 1, 1]   ,		__lowerCamelCase=4   ,		__lowerCamelCase=0.0   ,		__lowerCamelCase="gelu"   ,		__lowerCamelCase=True   ,		__lowerCamelCase=1e-5   ,		__lowerCamelCase=0.0_2   ,		**__lowerCamelCase   ,		):



     '''simple docstring'''




     __A       :		str							=	num_channels
     __A       :		List[str]							=	patch_size
     __A       :		str							=	stride
     __A       :		Any							=	padding
     __A       :		Any							=	pool_size
     __A       :		Dict							=	hidden_sizes
     __A       :		Optional[Any]							=	mlp_ratio
     __A       :		Any							=	depths
     __A       :		List[str]							=	patch_sizes
     __A       :		Union[str, Any]							=	strides
     __A       :		List[str]							=	num_encoder_blocks
     __A       :		Optional[int]							=	drop_path_rate
     __A       :		Union[str, Any]							=	hidden_act
     __A       :		Optional[Any]							=	use_layer_scale
     __A       :		List[Any]							=	layer_scale_init_value
     __A       :		List[Any]							=	initializer_range
     super().__init__(**__lowerCamelCase    )






class 						__snake_case   (						SCREAMING_SNAKE_CASE__	):





 """simple docstring"""


 _lowerCamelCase								=	version.parse("""1.11"""	)

 @property
 def    UpperCamelCase__(       self    ):



     '''simple docstring'''




     return OrderedDict(
         [
             ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
         ]    )







 @property
 def    UpperCamelCase__(       self    ):



     '''simple docstring'''




     return 2e-3




