o
    Me	                     @   sb   d Z ddlm  mZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ edG dd	 d	eZdS )
z3Thresholded Rectified Linear Unit activation layer.    N)backend)Layer)tf_utils)keras_exportzkeras.layers.ThresholdedReLUc                       sD   e Zd ZdZd fdd	Zdd Z fddZejd	d
 Z	  Z
S )ThresholdedReLUa  Thresholded Rectified Linear Unit.

    It follows:

    ```
      f(x) = x for x > theta
      f(x) = 0 otherwise`
    ```

    Input shape:
      Arbitrary. Use the keyword argument `input_shape`
      (tuple of integers, does not include the samples axis)
      when using this layer as the first layer in a model.

    Output shape:
      Same shape as the input.

    Args:
      theta: Float >= 0. Threshold location of activation.
          ?c                    sT   t  jdi | |d u rtd| |dk rtd| d| _t|| _d S )NzOTheta of a Thresholded ReLU layer cannot be None, expecting a float. Received: r   zEThe theta value of a Thresholded ReLU layer should be >=0. Received: T )super__init__
ValueErrorZsupports_maskingr   Zcast_to_floatxtheta)selfr   kwargs	__class__r   XD:\Projects\ConvertPro\env\Lib\site-packages\keras/layers/activation/thresholded_relu.pyr
   3   s   zThresholdedReLU.__init__c                 C   s    | j }|tt|| j| S N)Zcompute_dtypetfcastZgreaterr   )r   ZinputsZdtyper   r   r   callB   s   zThresholdedReLU.callc                    s4   dt | ji}t  }tt| t|  S )Nr   )floatr   r	   
get_configdictlistitems)r   configZbase_configr   r   r   r   F   s   
zThresholdedReLU.get_configc                 C   s   |S r   r   )r   Zinput_shaper   r   r   compute_output_shapeK   s   z$ThresholdedReLU.compute_output_shape)r   )__name__
__module____qualname____doc__r
   r   r   r   Zshape_type_conversionr   __classcell__r   r   r   r   r      s    r   )r    Ztensorflow.compat.v2compatv2r   Zkerasr   Zkeras.engine.base_layerr   Zkeras.utilsr   Z tensorflow.python.util.tf_exportr   r   r   r   r   r   <module>   s   