o
    $i                     @   sj   d dl mZmZ d dlmZmZ d dlmZ d dlm	Z	 d dl
mZ e	 \ZZZeG dd dedZd	S )
    )ABCMetaabstractmethod)AnyUnion)OldAPIStack)try_import_tf)
TensorTypec                   @   s|   e Zd ZdZdd Zdeeef defddZ	deeef defdd	Z
edeeef defd
dZdedefddZdS )Schedulea  Schedule classes implement various time-dependent scheduling schemas.

    - Constant behavior.
    - Linear decay.
    - Piecewise decay.
    - Exponential decay.

    Useful for backend-agnostic rate/weight changes for learning rates,
    exploration epsilons, beta parameters for prioritized replay, loss weights
    decay, etc..

    Each schedule can be called directly with the `t` (absolute time step)
    value and returns the value dependent on the Schedule and the passed time.
    c                 C   s
   || _ d S )N)	framework)selfr
    r   _/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/rllib/utils/schedules/schedule.py__init__   s   
zSchedule.__init__treturnc                 C   s   | j dv r
| |S | |S )zGenerates the value given a timestep (based on schedule's logic).

        Args:
            t: The time step. This could be a tf.Tensor.

        Returns:
            The calculated value depending on the schedule and `t`.
        )tf2tf)r
   _tf_value_op_valuer   r   r   r   r   value   s   
	

zSchedule.valuec                 C   
   |  |S )zCSimply calls self.value(t). Implemented to make Schedules callable.)r   r   r   r   r   __call__,   s   
zSchedule.__call__c                 C   s   t )z
        Returns the value based on a time step input.

        Args:
            t: The time step. This could be a tf.Tensor.

        Returns:
            The calculated value depending on the schedule and `t`.
        )NotImplementedErrorr   r   r   r   r   0   s   zSchedule._valuec                 C   r   )z
        Returns the tf-op that calculates the value based on a time step input.

        Args:
            t: The time step op (int tf.Tensor).

        Returns:
            The calculated value depending on the schedule and `t`.
        )r   r   r   r   r   r   =   s   
zSchedule._tf_value_opN)__name__
__module____qualname____doc__r   r   intr   r   r   r   r   r   r   r   r   r   r   r	      s    r	   )	metaclassN)abcr   r   typingr   r   ray.rllib.utils.annotationsr   ray.rllib.utils.frameworkr   ray.rllib.utils.typingr   tf1r   tfvr	   r   r   r   r   <module>   s    