





'''simple docstring'''






import colorsys
import io

import cva
import matplotlib as mpl
import matplotlib.colors as mplc
import matplotlib.figure as mplfigure
import numpy as np
import torch
from matplotlib.backends.backend_agg import FigureCanvasAgg

from utils import img_tensorize


snake_case_     			=						10_00


class 	_lowercase    :


   def __init__(			self     , _UpperCAmelCase     , _UpperCAmelCase=1.2     , _UpperCAmelCase="g"     , _UpperCAmelCase=0.5     , _UpperCAmelCase="-"     , _UpperCAmelCase="test_out.jpg"     , _UpperCAmelCase=True     , _UpperCAmelCase=False     , _UpperCAmelCase=None     , _UpperCAmelCase=None     , _UpperCAmelCase=0.7     , ):
       if isinstance(SCREAMING_SNAKE_CASE_     , torch.Tensor       ):
           A							:							List[Any]				=    img.numpy().astype('''np.uint8'''       )
       if isinstance(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_       ):
           A							:							Union[str, Any]				=    img_tensorize(SCREAMING_SNAKE_CASE_       )
       assert isinstance(SCREAMING_SNAKE_CASE_     , np.ndarray       )

       A							:							str				=    img.shape[1], img.shape[0]
       A							:							Union[str, Any]				=    mplfigure.Figure(frameon=SCREAMING_SNAKE_CASE_       )
       A							:							Any				=    fig.get_dpi()
       A							:							List[Any]				=    (width * scale + 1E-2) / dpi
       A							:							str				=    (height * scale + 1E-2) / dpi
       fig.set_size_inches(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_       )
       A							:							str				=    fig.add_axes([0.0, 0.0, 1.0, 1.0]       )
       ax.axis('''off'''       )
       ax.set_xlim(0.0     , SCREAMING_SNAKE_CASE_       )
       ax.set_ylim(SCREAMING_SNAKE_CASE_       )

       A							:							str				=    saveas
       A							:							List[str]				=    rgb
       A							:							int				=    pynb
       A							:							List[Any]				=    img
       A							:							Optional[int]				=    edgecolor
       A							:							Optional[int]				=    0.5
       A							:							int				=    linestyle
       A							:							List[str]				=    int(np.sqrt(min(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_       )       ) * scale // 3       )
       A							:							int				=    width
       A							:							Dict				=    height
       A							:							Union[str, Any]				=    scale
       A							:							Union[str, Any]				=    fig
       A							:							Optional[int]				=    ax
       A							:							Dict				=    pad
       A							:							List[Any]				=    idaobj
       A							:							str				=    idaattr
       A							:							str				=    FigureCanvasAgg(SCREAMING_SNAKE_CASE_       )


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase=None       ):
       if color is None:
           A							:							int				=    self.edgecolor
       (A)							:							Optional[Any]				=    box
       A							:							Optional[int]				=    xa - xa
       A							:							Optional[Any]				=    ya - ya
       self.ax.add_patch(
           mpl.patches.Rectangle(
               (xa, ya)     , SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , fill=SCREAMING_SNAKE_CASE_     , edgecolor=SCREAMING_SNAKE_CASE_     , linewidth=self.font_size // 3     , alpha=self.alpha     , linestyle=self.linestyle     , )       )


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase=None     , _UpperCAmelCase=None     , _UpperCAmelCase=None     , _UpperCAmelCase=None       ):
       if len(boxes.shape       ) > 2:
           A							:							Optional[Any]				=    boxes[0]
       if len(obj_ids.shape       ) > 1:
           A							:							str				=    obj_ids[0]
       if len(obj_scores.shape       ) > 1:
           A							:							Tuple				=    obj_scores[0]
       if len(attr_ids.shape       ) > 1:
           A							:							Optional[Any]				=    attr_ids[0]
       if len(attr_scores.shape       ) > 1:
           A							:							Optional[int]				=    attr_scores[0]
       if isinstance(SCREAMING_SNAKE_CASE_     , torch.Tensor       ):
           A							:							str				=    boxes.numpy()
       if isinstance(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_       ):
           A							:							List[str]				=    np.array(SCREAMING_SNAKE_CASE_       )
       assert isinstance(SCREAMING_SNAKE_CASE_     , np.ndarray       )
       A							:							List[str]				=    np.prod(boxes[:, 2:] - boxes[:, :2]     , axis=1       )
       A							:							str				=    np.argsort(-areas       ).tolist()
       A							:							Dict				=    boxes[sorted_idxs] if boxes is not None else None
       A							:							Tuple				=    obj_ids[sorted_idxs] if obj_ids is not None else None
       A							:							int				=    obj_scores[sorted_idxs] if obj_scores is not None else None
       A							:							List[Any]				=    attr_ids[sorted_idxs] if attr_ids is not None else None
       A							:							str				=    attr_scores[sorted_idxs] if attr_scores is not None else None

       A							:							Any				=    [self._random_color(maximum=1       ) for _ in range(len(SCREAMING_SNAKE_CASE_       )       )]
       A							:							Union[str, Any]				=    [assigned_colors[idx] for idx in sorted_idxs]
       if obj_ids is not None:
           A							:							List[Any]				=    self._create_text_labels_attr(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_       )
           for i in range(len(SCREAMING_SNAKE_CASE_       )       ):
               A							:							List[str]				=    assigned_colors[i]
               self.add_box(boxes[i]     , SCREAMING_SNAKE_CASE_       )
               self.draw_labels(labels[i]     , boxes[i]     , SCREAMING_SNAKE_CASE_       )


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase     , _UpperCAmelCase       ):
       A							:							Optional[Any]				=    box
       A							:							Dict				=    (xa, ya)
       A							:							Union[str, Any]				=    (ya - ya) * (xa - xa)
       A							:							Any				=    _SMALL_OBJ * self.scale
       if instance_area < small or ya - ya < 40 * self.scale:
           if ya >= self.height - 5:
               A							:							Tuple				=    (xa, ya)
           else:
               A							:							int				=    (xa, ya)

       A							:							int				=    (ya - ya) / np.sqrt(self.height * self.width       )
       A							:							Any				=    self._change_color_brightness(SCREAMING_SNAKE_CASE_     , brightness_factor=0.7       )
       A							:							List[Any]				=    np.clip((height_ratio - 0.02) / 0.08 + 1     , 1.2     , 2       )
       font_size *= 0.75 * self.font_size

       self.draw_text(
           text=SCREAMING_SNAKE_CASE_     , position=SCREAMING_SNAKE_CASE_     , color=SCREAMING_SNAKE_CASE_     , )


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase     , _UpperCAmelCase="g"     , _UpperCAmelCase="left"     , ):
       A							:							Optional[int]				=    0
       A							:							Optional[Any]				=    self.font_size
       A							:							Dict				=    np.maximum(list(mplc.to_rgb(SCREAMING_SNAKE_CASE_       )       )     , 0.2       )
       A							:							Union[str, Any]				=    max(0.8     , np.max(SCREAMING_SNAKE_CASE_       )       )
       A							:							Optional[Any]				=    {
           """facecolor""": """black""",
           """alpha""": self.alpha,
           """pad""": self.pad,
           """edgecolor""": """none""",
       }
       A							:							Any				=    position
       self.ax.text(
           SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , size=font_size * self.scale     , family='''sans-serif'''     , bbox=SCREAMING_SNAKE_CASE_     , verticalalignment='''top'''     , horizontalalignment=SCREAMING_SNAKE_CASE_     , color=SCREAMING_SNAKE_CASE_     , zorder=10     , rotation=SCREAMING_SNAKE_CASE_     , )


   def        snake_case					(			self     , _UpperCAmelCase=None       ):
       if saveas is None:
           A							:							Optional[int]				=    self.saveas
       if saveas.lower().endswith('''.jpg'''       ) or saveas.lower().endswith('''.png'''       ):
           cva.imwrite(
               SCREAMING_SNAKE_CASE_     , self._get_buffer()[:, :, ::-1]     , )
       else:
           self.fig.savefig(SCREAMING_SNAKE_CASE_       )


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase     , _UpperCAmelCase     , _UpperCAmelCase       ):
       A							:							Optional[Any]				=    [self.idaobj[i] for i in classes]
       A							:							Optional[Any]				=    [self.idaattr[i] for i in attr_classes]
       A							:							Optional[int]				=    [
           f'''{label} {score:.2f} {attr} {attr_score:.2f}'''
           for label, score, attr, attr_score in zip(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_       )
       ]
       return labels


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase       ):
       A							:							int				=    [self.idaobj[i] for i in classes]
       if scores is not None:
           if labels is None:
               A							:							Tuple				=    ["""{:.0f}%""".format(s * 100       ) for s in scores]
           else:
               A							:							int				=    ["""{} {:.0f}%""".format(SCREAMING_SNAKE_CASE_     , s * 100       ) for li, s in zip(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_       )]
       return labels


   def        snake_case					(			self     , _UpperCAmelCase=255       ):
       A							:							Tuple				=    np.random.randint(0     , len(_COLORS       )       )
       A							:							Tuple				=    _COLORS[idx] * maximum
       if not self.rgb:
           A							:							str				=    ret[::-1]
       return ret


   def        snake_case					(			self       ):
       if not self.pynb:
           A							:							Optional[Any]				=    self.canvas.print_to_buffer()
           if (width, height) != (self.width, self.height):
               A							:							Optional[int]				=    cva.resize(self.img     , (width, height)       )
           else:
               A							:							Any				=    self.img
       else:
           A							:							int				=    io.BytesIO()  # works for cairo backend
           self.canvas.print_rgba(SCREAMING_SNAKE_CASE_       )
           A							:							str				=    self.width, self.height
           A							:							Dict				=    buf.getvalue()
           A							:							str				=    self.img

       A							:							Any				=    np.frombuffer(SCREAMING_SNAKE_CASE_     , dtype='''uint8'''       )
       A							:							Optional[Any]				=    buffer.reshape(SCREAMING_SNAKE_CASE_     , SCREAMING_SNAKE_CASE_     , 4       )
       A							:							Union[str, Any]				=    np.split(SCREAMING_SNAKE_CASE_     , [3]     , axis=2       )

       try:
           import numexpr as ne  # fuse them with numexpr

           A							:							Any				=    ne.evaluate('''img * (1 - alpha / 255.0) + rgb * (alpha / 255.0)'''       )
       except ImportError:
           A							:							Optional[int]				=    alpha.astype('''float32'''       ) / 255.0
           A							:							str				=    img * (1 - alpha) + rgb * alpha

       return visualized_image.astype('''uint8'''       )


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase       ):
       assert brightness_factor >= -1.0 and brightness_factor <= 1.0
       A							:							List[Any]				=    mplc.to_rgb(SCREAMING_SNAKE_CASE_       )
       A							:							List[Any]				=    colorsys.rgb_to_hls(*mplc.to_rgb(SCREAMING_SNAKE_CASE_       )       )
       A							:							str				=    polygon_color[1] + (brightness_factor * polygon_color[1])
       A							:							Union[str, Any]				=    0.0 if modified_lightness < 0.0 else modified_lightness
       A							:							Any				=    1.0 if modified_lightness > 1.0 else modified_lightness
       A							:							Any				=    colorsys.hls_to_rgb(polygon_color[0]     , SCREAMING_SNAKE_CASE_     , polygon_color[2]       )
       return modified_color







snake_case_     			=						(
    np.array(
        [
            0.0_00,
            0.4_47,
            0.7_41,
            0.8_50,
            0.3_25,
            0.0_98,
            0.9_29,
            0.6_94,
            0.1_25,
            0.4_94,
            0.1_84,
            0.5_56,
            0.4_66,
            0.6_74,
            0.1_88,
            0.3_01,
            0.7_45,
            0.9_33,
            0.6_35,
            0.0_78,
            0.1_84,
            0.3_00,
            0.3_00,
            0.3_00,
            0.6_00,
            0.6_00,
            0.6_00,
            1.0_00,
            0.0_00,
            0.0_00,
            1.0_00,
            0.5_00,
            0.0_00,
            0.7_49,
            0.7_49,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            1.0_00,
            0.6_67,
            0.0_00,
            1.0_00,
            0.3_33,
            0.3_33,
            0.0_00,
            0.3_33,
            0.6_67,
            0.0_00,
            0.3_33,
            1.0_00,
            0.0_00,
            0.6_67,
            0.3_33,
            0.0_00,
            0.6_67,
            0.6_67,
            0.0_00,
            0.6_67,
            1.0_00,
            0.0_00,
            1.0_00,
            0.3_33,
            0.0_00,
            1.0_00,
            0.6_67,
            0.0_00,
            1.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.3_33,
            0.5_00,
            0.0_00,
            0.6_67,
            0.5_00,
            0.0_00,
            1.0_00,
            0.5_00,
            0.3_33,
            0.0_00,
            0.5_00,
            0.3_33,
            0.3_33,
            0.5_00,
            0.3_33,
            0.6_67,
            0.5_00,
            0.3_33,
            1.0_00,
            0.5_00,
            0.6_67,
            0.0_00,
            0.5_00,
            0.6_67,
            0.3_33,
            0.5_00,
            0.6_67,
            0.6_67,
            0.5_00,
            0.6_67,
            1.0_00,
            0.5_00,
            1.0_00,
            0.0_00,
            0.5_00,
            1.0_00,
            0.3_33,
            0.5_00,
            1.0_00,
            0.6_67,
            0.5_00,
            1.0_00,
            1.0_00,
            0.5_00,
            0.0_00,
            0.3_33,
            1.0_00,
            0.0_00,
            0.6_67,
            1.0_00,
            0.0_00,
            1.0_00,
            1.0_00,
            0.3_33,
            0.0_00,
            1.0_00,
            0.3_33,
            0.3_33,
            1.0_00,
            0.3_33,
            0.6_67,
            1.0_00,
            0.3_33,
            1.0_00,
            1.0_00,
            0.6_67,
            0.0_00,
            1.0_00,
            0.6_67,
            0.3_33,
            1.0_00,
            0.6_67,
            0.6_67,
            1.0_00,
            0.6_67,
            1.0_00,
            1.0_00,
            1.0_00,
            0.0_00,
            1.0_00,
            1.0_00,
            0.3_33,
            1.0_00,
            1.0_00,
            0.6_67,
            1.0_00,
            0.3_33,
            0.0_00,
            0.0_00,
            0.5_00,
            0.0_00,
            0.0_00,
            0.6_67,
            0.0_00,
            0.0_00,
            0.8_33,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            0.1_67,
            0.0_00,
            0.0_00,
            0.3_33,
            0.0_00,
            0.0_00,
            0.5_00,
            0.0_00,
            0.0_00,
            0.6_67,
            0.0_00,
            0.0_00,
            0.8_33,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            0.1_67,
            0.0_00,
            0.0_00,
            0.3_33,
            0.0_00,
            0.0_00,
            0.5_00,
            0.0_00,
            0.0_00,
            0.6_67,
            0.0_00,
            0.0_00,
            0.8_33,
            0.0_00,
            0.0_00,
            1.0_00,
            0.0_00,
            0.0_00,
            0.0_00,
            0.1_43,
            0.1_43,
            0.1_43,
            0.8_57,
            0.8_57,
            0.8_57,
            1.0_00,
            1.0_00,
            1.0_00,
        ]
    )
    .astype(np.floataa)
    .reshape(-1, 3)
)




import math
from collections import OrderedDict

import torch
from packaging import version
from torch import Tensor, nn

from .utils import logging


_A		:					Optional[int]          =							logging.get_logger(__name__)



class 							a       (      nn.Module ):





     def __init__(     self       :					Dict				):
        super().__init__()
        if version.parse(torch.__version__				) < version.parse("""1.12.0"""				):
           raise ImportError(
               F'You are using torch=={torch.__version__}, but torch>=1.12.0 is required to use '
               """PytorchGELUTanh. Please upgrade torch."""				)







     def 			SCREAMING_SNAKE_CASE__							(     self       :					int     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return nn.functional.gelu(SCREAMING_SNAKE_CASE_     ,						approximate="""tanh"""				)



class 							a       (      nn.Module ):





     def 			SCREAMING_SNAKE_CASE__							(     self       :					Any     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return 0.5 * input * (1.0 + torch.tanh(math.sqrt(2.0 / math.pi				) * (input + 0.04_4715 * torch.pow(SCREAMING_SNAKE_CASE_     ,						3.0				))				))



class 							a       (      nn.Module ):





     def __init__(     self       :					List[Any]     ,						SCREAMING_SNAKE_CASE_       :					bool = False				):
        super().__init__()
        if use_gelu_python:
           __lowerCamelCase:					Union[str, Any]	 =						self._gelu_python
        else:
           __lowerCamelCase:					Tuple	 =						nn.functional.gelu





     def 			SCREAMING_SNAKE_CASE__							(     self       :					str     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return input * 0.5 * (1.0 + torch.erf(input / math.sqrt(2.0				)				))







     def 			SCREAMING_SNAKE_CASE__							(     self       :					Union[str, Any]     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return self.act(SCREAMING_SNAKE_CASE_				)



class 							a       (      nn.Module ):





     def 			SCREAMING_SNAKE_CASE__							(     self       :					List[str]     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return 0.5 * input * (1.0 + torch.tanh(input * 0.79_7884_5608 * (1.0 + 0.04_4715 * input * input)				))



class 							a       (      nn.Module ):





     def 			SCREAMING_SNAKE_CASE__							(     self       :					List[Any]     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return input * torch.sigmoid(1.702 * input				)



class 							a       (      nn.Module ):





     def __init__(     self       :					List[str]     ,						SCREAMING_SNAKE_CASE_       :					float     ,						SCREAMING_SNAKE_CASE_       :					float				):
        if min > max:
           raise ValueError(F'min should be < max (got min: {min}, max: {max})'				)

        super().__init__()
        __lowerCamelCase:					Optional[int]	 =						min
        __lowerCamelCase:					str	 =						max







     def 			SCREAMING_SNAKE_CASE__							(     self       :					List[str]     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return torch.clip(gelu(SCREAMING_SNAKE_CASE_				)     ,						self.min     ,						self.max				)



class 							a       (      nn.Module ):





     def __init__(     self       :					int				):
        super().__init__()
        __lowerCamelCase:					List[str]	 =						math.sqrt(2 / math.pi				)







     def 			SCREAMING_SNAKE_CASE__							(     self       :					Tuple     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return 0.5 * input * (1 + torch.tanh(self.precomputed_constant * (input + 0.04_4715 * torch.pow(SCREAMING_SNAKE_CASE_     ,						3				))				))



class 							a       (      nn.Module ):





     def 			SCREAMING_SNAKE_CASE__							(     self       :					Any     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return nn.functional.silu(SCREAMING_SNAKE_CASE_				)



class 							a       (      nn.Module ):





     def __init__(     self       :					Any				):
        super().__init__()
        if version.parse(torch.__version__				) < version.parse("""1.9.0"""				):
           __lowerCamelCase:					str	 =						self._mish_python
        else:
           __lowerCamelCase:					Any	 =						nn.functional.mish





     def 			SCREAMING_SNAKE_CASE__							(     self       :					int     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return input * torch.tanh(nn.functional.softplus(SCREAMING_SNAKE_CASE_				)				)







     def 			SCREAMING_SNAKE_CASE__							(     self       :					List[str]     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return self.act(SCREAMING_SNAKE_CASE_				)



class 							a       (      nn.Module ):





     def 			SCREAMING_SNAKE_CASE__							(     self       :					List[str]     ,						SCREAMING_SNAKE_CASE_       :					Tensor				):
        return input



class 							a       (      nn.Module ):





     def 			SCREAMING_SNAKE_CASE__							(     self       :					Optional[int]     ,						SCREAMING_SNAKE_CASE_       :					str     ,						SCREAMING_SNAKE_CASE_       :					Optional[int]=0.70_7107     ,						SCREAMING_SNAKE_CASE_       :					Tuple=0.28_2095				):
        __lowerCamelCase:					Optional[Any]	 =						(input - mu).div(sigma * math.sqrt(2.0				)				)
        return 0.5 * (1.0 + torch.erf(SCREAMING_SNAKE_CASE_				))



class 							a       (      nn.Module ):





     def 			SCREAMING_SNAKE_CASE__							(     self       :					int     ,						SCREAMING_SNAKE_CASE_       :					str				):
        __lowerCamelCase:					Any	 =						nn.functional.relu(SCREAMING_SNAKE_CASE_				)
        __lowerCamelCase:					List[str]	 =						torch.square(SCREAMING_SNAKE_CASE_				)
        return squared



class 							a       (      _UpperCAmelCase ):





     def __getitem__(     self       :					str     ,						SCREAMING_SNAKE_CASE_       :					Tuple				):
        __lowerCamelCase:					Optional[Any]	 =						super().__getitem__(SCREAMING_SNAKE_CASE_				)
        __lowerCamelCase ,  __lowerCamelCase:					Optional[Any]	 =						content if isinstance(SCREAMING_SNAKE_CASE_     ,						SCREAMING_SNAKE_CASE_				) else (content, {})
        return cls(**SCREAMING_SNAKE_CASE_				)



_A		:					Optional[Any]          =							{
    '''gelu''': GELUActivation,
    '''gelu_10''': (ClippedGELUActivation, {'''min''': -10, '''max''': 10}),
    '''gelu_fast''': FastGELUActivation,
    '''gelu_new''': NewGELUActivation,
    '''gelu_python''': (GELUActivation, {'''use_gelu_python''': True}),
    '''gelu_pytorch_tanh''': PytorchGELUTanh,
    '''gelu_accurate''': AccurateGELUActivation,
    '''laplace''': LaplaceActivation,
    '''linear''': LinearActivation,
    '''mish''': MishActivation,
    '''quick_gelu''': QuickGELUActivation,
    '''relu''': nn.ReLU,
    '''relu2''': ReLUSquaredActivation,
    '''relu6''': nn.ReLUa,
    '''sigmoid''': nn.Sigmoid,
    '''silu''': SiLUActivation,
    '''swish''': SiLUActivation,
    '''tanh''': nn.Tanh,
}
_A		:					Optional[int]          =							ClassInstantier(ACTaCLS)



def      __lowerCAmelCase    (				snake_case						:     Any			)							->				int:
   if activation_string in ACTaFN:
      return ACTaFN[activation_string]
   else:
      raise KeyError(f'function {activation_string} not found in ACT2FN mapping {list(ACTaFN.keys()			)}'			)


# For backwards compatibility with: from activations import gelu_python
_A		:					Optional[int]          =							get_activation('''gelu_python''')
_A		:					Dict          =							get_activation('''gelu_new''')
_A		:					List[str]          =							get_activation('''gelu''')
_A		:					Tuple          =							get_activation('''gelu_fast''')
_A		:					int          =							get_activation('''quick_gelu''')
_A		:					Tuple          =							get_activation('''silu''')
_A		:					Optional[Any]          =							get_activation('''mish''')







_A		:					Dict          =							get_activation('''linear''')


