o
    ciy                     @   st   d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 e \ZZZG dd der5ejjjZdS eZdS )	    )OptionalAny)try_import_tf)
TensorType)deprecation_warning)log_oncec                       sB   e Zd ZdZddedee f fddZdedefd	d
Z  Z	S )SkipConnectionzSkip connection layer.

    Adds the original input to the output (regular residual layer) OR uses
    input as hidden state input to a given fan_in_layer.
    Nlayerfan_in_layerc                    s4   t dr	tdd t jdi | || _|| _dS )a?  Initializes a SkipConnection keras layer object.

        Args:
            layer (tf.keras.layers.Layer): Any layer processing inputs.
            fan_in_layer (Optional[tf.keras.layers.Layer]): An optional
                layer taking two inputs: The original input and the output
                of `layer`.
        skip_connectionz%rllib.models.tf.layers.SkipConnection)oldN )r   r   super__init___layer_fan_in_layer)selfr	   r
   kwargs	__class__r   ^/home/ubuntu/.local/lib/python3.10/site-packages/ray/rllib/models/tf/layers/skip_connection.pyr      s   	
zSkipConnection.__init__inputsreturnc                 K   s:   | j |fi |}| jd u r|| }|S | ||f}|S N)r   r   )r   r   r   outputsr   r   r   call#   s   
zSkipConnection.callr   )
__name__
__module____qualname____doc__r   r   r   r   r   __classcell__r   r   r   r   r      s    r   N)typingr   r   ray.rllib.utils.frameworkr   ray.rllib.utils.typingr   ray.rllib.utils.deprecationr   ray.utilr   tf1tftfvkeraslayersLayerobjectr   r   r   r   r   <module>   s    (