
'''simple docstring'''
def 			a_							(  UpperCamelCase_	,     UpperCamelCase_	,     UpperCamelCase_	,     UpperCamelCase_   ):
							A_ 						=		int((lower_bound + upper_bound) // 2   )
							if array[r] == value:
														return r
							if lower_bound >= upper_bound:
														return -1
							if array[r] < value:
														return binary_search(UpperCamelCase__	,     r + 1	,     UpperCamelCase__	,     UpperCamelCase__   )
							else:
														return binary_search(UpperCamelCase__	,     UpperCamelCase__	,     r - 1	,     UpperCamelCase__   )







def 			a_							(  UpperCamelCase_	,     UpperCamelCase_   ):
							A_ 						=		0
							if matrix[index][0] == value:
														return [index, 0]
							while index < len(UpperCamelCase__   ) and matrix[index][0] < value:
														A_ 						=		binary_search(matrix[index]	,     0	,     len(matrix[index]   ) - 1	,     UpperCamelCase__   )
														if r != -1:
																					return [index, r]
														index += 1
							return [-1, -1]


if __name__ == "__main__":
							import doctest

							doctest.testmod()









'''simple docstring'''
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	):

						"""simple docstring"""






						def 							_UpperCAmelCase					(     self       :			List[Any]  ):
													A_ 						=		tf.constant([-1_00, -1.0, -0.1, 0, 0.1, 1.0, 1_0_0.0]  )
													A_ 						=		get_tf_activation("gelu"  )
													A_ 						=		get_tf_activation("gelu_10"  )

													A_ 						=		gelu(lowerCAmelCase  )
													A_ 						=		geluaa(lowerCAmelCase  )

													A_ 						=		tf.where(y_gelu_aa < 1_0.0   ,     1.0   ,     0.0  )

													self.assertEqual(tf.math.reduce_max(lowerCAmelCase  ).numpy().item()   ,     1_0.0  )
													self.assertTrue(np.allclose(y_gelu * clipped_mask   ,     y_gelu_aa * clipped_mask  )  )






						def 							_UpperCAmelCase					(     self       :			Union[str, 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(lowerCAmelCase  ):
																				get_tf_activation("bogus"  )
													with self.assertRaises(lowerCAmelCase  ):
																				get_tf_activation(lowerCAmelCase  )





