




import unittest

import numpy as np

from transformers import is_tf_available
from transformers.testing_utils import require_tf


if is_tf_available():
							import tensorflow as tf

							from transformers.activations_tf import get_tf_activation


@require_tf
class 							_lowerCAmelCase		(     unittest.TestCase	):




				def     __a		( self							)    ->      int:
											SCREAMING_SNAKE_CASE			: List[Any]	     =tf.constant([-100, -1.0, -0.1, 0, 0.1, 1.0, 100.0]							)
											SCREAMING_SNAKE_CASE			: Optional[Any]	     =get_tf_activation('''gelu'''							)
											SCREAMING_SNAKE_CASE			: Optional[int]	     =get_tf_activation('''gelu_10'''							)

											SCREAMING_SNAKE_CASE			: str	     =gelu(snake_case_							)
											SCREAMING_SNAKE_CASE			: Union[str, Any]	     =geluaa(snake_case_							)

											SCREAMING_SNAKE_CASE			: Tuple	     =tf.where(y_gelu_aa < 10.0		,		1.0		,		0.0							)

											self.assertEqual(tf.math.reduce_max(snake_case_							).numpy().item()		,		10.0							)
											self.assertTrue(np.allclose(y_gelu * clipped_mask		,		y_gelu_aa * clipped_mask							)							)







				def     __a		( self							)    ->      Optional[Any]:
											get_tf_activation('''gelu'''							)
											get_tf_activation('''gelu_10'''							)
											get_tf_activation('''gelu_fast'''							)
											get_tf_activation('''gelu_new'''							)
											get_tf_activation('''glu'''							)
											get_tf_activation('''mish'''							)
											get_tf_activation('''quick_gelu'''							)
											get_tf_activation('''relu'''							)
											get_tf_activation('''sigmoid'''							)
											get_tf_activation('''silu'''							)
											get_tf_activation('''swish'''							)
											get_tf_activation('''tanh'''							)
											with self.assertRaises(snake_case_							):
																		get_tf_activation('''bogus'''							)
											with self.assertRaises(snake_case_							):
																		get_tf_activation(snake_case_							)












def 						lowerCAmelCase_       (	__a = "mytext.txt"	,	__a = False )       ->			None:





							"""simple docstring"""





							import socket

							SCREAMING_SNAKE_CASE			: int	     =12312  # Reserve a port for your service.
							SCREAMING_SNAKE_CASE			: Dict	     =socket.socket()  # Create a socket object
							SCREAMING_SNAKE_CASE			: Any	     =socket.gethostname()  # Get local machine name
							sock.bind((host, port) )  # Bind to the port
							sock.listen(5 )  # Now wait for client connection.

							print('''Server listening....''' )

							while True:
														SCREAMING_SNAKE_CASE     ,							SCREAMING_SNAKE_CASE			: Optional[int]	     =sock.accept()  # Establish connection with client.
														print(f'Got connection from {addr}' )
														SCREAMING_SNAKE_CASE			: List[str]	     =conn.recv(1024 )
														print(f'Server received: {data = }' )

														with open(__a	,	'''rb''' ) as in_file:
																					SCREAMING_SNAKE_CASE			: Dict	     =in_file.read(1024 )
																					while data:
																												conn.send(__a )
																												print(f'Sent {data!r}' )
																												SCREAMING_SNAKE_CASE			: str	     =in_file.read(1024 )

														print('''Done sending''' )
														conn.close()
														if testing:  # Allow the test to complete
																					break

							sock.shutdown(1 )
							sock.close()


if __name__ == "__main__":
							send_file()






