



def 	__lowerCAmelCase						(		__UpperCamelCase      :			str					, __UpperCamelCase      :			Optional[int]    ):


						'''simple docstring'''






						return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2
def 	__lowerCAmelCase						(		__UpperCamelCase      :			Tuple					, __UpperCamelCase      :			List[Any]=0    ):


						'''simple docstring'''






						return sorted(a_					, key=lambda __UpperCamelCase    : x[column]    )
def 	__lowerCAmelCase						(		__UpperCamelCase      :			List[str]					, __UpperCamelCase      :			str					, __UpperCamelCase      :			Union[str, Any]=float("""inf"""    )    ):


						'''simple docstring'''






						for i in range(points_counts - 1    ):
												for j in range(i + 1					, a_    ):
																		snake_case_   : str						=			euclidean_distance_sqr(points[i]					, points[j]    )
																		if current_dis < min_dis:
																								snake_case_   : List[str]						=			current_dis
						return min_dis
def 	__lowerCAmelCase						(		__UpperCamelCase      :			Optional[int]					, __UpperCamelCase      :			List[Any]					, __UpperCamelCase      :			Dict=float("""inf"""    )    ):


						'''simple docstring'''






						for i in range(min(6					, points_counts - 1    )					, a_    ):
												for j in range(max(0					, i - 6    )					, a_    ):
																		snake_case_   : List[Any]						=			euclidean_distance_sqr(points[i]					, points[j]    )
																		if current_dis < min_dis:
																								snake_case_   : Tuple						=			current_dis
						return min_dis
def 	__lowerCAmelCase						(		__UpperCamelCase      :			Union[str, Any]					, __UpperCamelCase      :			Union[str, Any]					, __UpperCamelCase      :			Optional[int]    ):


						'''simple docstring'''






						if points_counts <= 3:
												return dis_between_closest_pair(a_					, a_    )

						# recursion
						snake_case_   : Any						=			points_counts // 2
						snake_case_   : List[str]						=			closest_pair_of_points_sqr(
						    a_					, points_sorted_on_y[:mid]					, a_    )
						snake_case_   : Any						=			closest_pair_of_points_sqr(
						    a_					, points_sorted_on_y[mid:]					, points_counts - mid    )
						snake_case_   : Tuple						=			min(a_					, a_    )
						snake_case_   : Tuple						=			[]
						for point in points_sorted_on_x:
												if abs(point[0] - points_sorted_on_x[mid][0]    ) < closest_pair_dis:
																		cross_strip.append(a_    )

						snake_case_   : List[Any]						=			dis_between_closest_in_strip(
						    a_					, len(a_    )					, a_    )
						return min(a_					, a_    )
def 	__lowerCAmelCase						(		__UpperCamelCase      :			str					, __UpperCamelCase      :			Union[str, Any]    ):


						'''simple docstring'''






						snake_case_   : Optional[int]						=			column_based_sort(a_					, column=0    )
						snake_case_   : List[Any]						=			column_based_sort(a_					, column=1    )
						return (
						    closest_pair_of_points_sqr(
						        a_					, a_					, a_    )
						) ** 0.5


if __name__ == "__main__":
					__lowerCAmelCase       :					List[Any]      					=					[(2, 3), (12, 30), (40, 50), (5, 1), (12, 10), (3, 4)]
					print('''Distance:''', closest_pair_of_points(points, len(points)))






"""simple docstring"""





import math

import tensorflow as tf
from packaging import version
def 	__lowerCAmelCase						(		__UpperCamelCase      :			List[Any]    ):


						'''simple docstring'''






						snake_case_   : int						=			tf.convert_to_tensor(__UpperCamelCase    )
						snake_case_   : int						=			0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0    )					, x.dtype    )    ))

						return x * cdf
def 	__lowerCAmelCase						(		__UpperCamelCase      :			List[str]    ):


						'''simple docstring'''






						snake_case_   : int						=			tf.convert_to_tensor(__UpperCamelCase    )
						snake_case_   : List[Any]						=			tf.cast(math.pi					, x.dtype    )
						snake_case_   : int						=			tf.cast(0.044_715					, x.dtype    )
						snake_case_   : Optional[int]						=			0.5 * (1.0 + tf.tanh(tf.sqrt(2.0 / pi    ) * (x + coeff * tf.pow(__UpperCamelCase					, 3    ))    ))

						return x * cdf
def 	__lowerCAmelCase						(		__UpperCamelCase      :			str    ):


						'''simple docstring'''






						snake_case_   : Optional[Any]						=			tf.convert_to_tensor(__UpperCamelCase    )

						return x * tf.tanh(tf.math.softplus(__UpperCamelCase    )    )
def 	__lowerCAmelCase						(		__UpperCamelCase      :			Any    ):


						'''simple docstring'''






						snake_case_   : str						=			tf.convert_to_tensor(__UpperCamelCase    )
						snake_case_   : int						=			tf.cast(0.044_715					, x.dtype    )
						snake_case_   : Optional[int]						=			tf.cast(0.7_978_845_608					, x.dtype    )

						return 0.5 * x * (1.0 + tf.tanh(x * coeffa * (1.0 + coeffa * x * x)    ))
def 	__lowerCAmelCase						(		__UpperCamelCase      :			List[str]    ):


						'''simple docstring'''






						snake_case_   : Tuple						=			tf.convert_to_tensor(__UpperCamelCase    )
						snake_case_   : str						=			tf.cast(1.702					, x.dtype    )
						return x * tf.math.sigmoid(coeff * x    )
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						return tf.clip_by_value(_gelu(__UpperCamelCase    )					, -1_0					, 1_0    )
def 	__lowerCAmelCase						(		__UpperCamelCase      :			Optional[int]					, __UpperCamelCase      :			List[str]=-1    ):


						'''simple docstring'''






						snake_case_			,		snake_case_   : List[Any]						=			tf.split(__UpperCamelCase					, 2					, axis=__UpperCamelCase    )
						return a * tf.math.sigmoid(__UpperCamelCase    )


if version.parse(tf.version.VERSION) >= version.parse('''2.4'''):
					def 	__lowerCAmelCase						(		__UpperCamelCase      :			List[Any]    ):


											'''simple docstring'''






											return tf.keras.activations.gelu(__UpperCamelCase					, approximate=__UpperCamelCase    )

					__lowerCAmelCase       :					int      					=					tf.keras.activations.gelu






					__lowerCAmelCase       :					Optional[Any]      					=					approximate_gelu_wrap
else:
					__lowerCAmelCase       :					List[Any]      					=					_gelu
					__lowerCAmelCase       :					Any      					=					_gelu_new


__lowerCAmelCase       :					Dict      					=					{
    '''gelu''': gelu,
    '''gelu_10''': gelu_aa,
    '''gelu_fast''': gelu_fast,
    '''gelu_new''': gelu_new,
    '''glu''': glu,
    '''mish''': mish,
    '''quick_gelu''': quick_gelu,
    '''relu''': tf.keras.activations.relu,
    '''sigmoid''': tf.keras.activations.sigmoid,
    '''silu''': tf.keras.activations.swish,
    '''swish''': tf.keras.activations.swish,
    '''tanh''': tf.keras.activations.tanh,
}






def 	__lowerCAmelCase						(		__UpperCamelCase      :			Any    ):


						'''simple docstring'''






						if activation_string in ACTaFN:
												return ACTaFN[activation_string]
						else:
												raise KeyError(F'function {activation_string} not found in ACT2FN mapping {list(ACTaFN.keys()    )}'    )

