o
    zi                     @  s0   d Z ddlmZ ddlmZ G dd deZdS )zEnumerated utilities.    )annotations)StrEnumc                   @  s4   e Zd ZdZdZdZeddd	ZedddZdS )GradClipAlgorithmTypea  Define gradient_clip_algorithm types - training-tricks.
    NORM type means "clipping gradients by norm". This computed over all model parameters together.
    VALUE type means "clipping gradients by value". This will clip the gradient value for each parameter.

    References:
        clip_by_norm: https://pytorch.org/docs/stable/nn.html#torch.nn.utils.clip_grad_norm_
        clip_by_value: https://pytorch.org/docs/stable/nn.html#torch.nn.utils.clip_grad_value_
    valuenormvalstrreturnboolc                   s   t  fddtD S )Nc                 3  s    | ]}|j  kV  qd S )Nr   .0xr    U/home/ubuntu/.local/lib/python3.10/site-packages/pytorch_lightning/utilities/enums.py	<genexpr>$   s    z7GradClipAlgorithmType.supported_type.<locals>.<genexpr>)anyr   r   r   r   r   supported_type"   s   z$GradClipAlgorithmType.supported_type	list[str]c                   C  s   dd t D S )Nc                 S  s   g | ]}|j qS r   r   r   r   r   r   
<listcomp>(   s    z9GradClipAlgorithmType.supported_types.<locals>.<listcomp>)r   r   r   r   r   supported_types&   s   z%GradClipAlgorithmType.supported_typesN)r   r   r	   r
   )r	   r   )	__name__
__module____qualname____doc__VALUENORMstaticmethodr   r   r   r   r   r   r      s    	r   N)r   
__future__r   lightning_utilities.core.enumsr   LightningEnumr   r   r   r   r   <module>   s   