
    &`i                         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e                      Zd	S )
    )ABCMetaabstractmethod)AnyUnion)OldAPIStack)try_import_tf)
TensorTypec                       e Zd ZdZd Zdeeef         defdZ	deeef         defdZ
edeeef         defd            Zdedef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                     || _         d S )N)	framework)selfr   s     v/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/rllib/utils/schedules/schedule.py__init__zSchedule.__init__   s    "    treturnc                 h    | 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   s     r   valuezSchedule.value   s5     >]**$$Q'''{{1~~r   c                 ,    |                      |          S )zCSimply calls self.value(t). Implemented to make Schedules callable.)r   r   s     r   __call__zSchedule.__call__,   s    zz!}}r   c                     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   s     r   r   zSchedule._value0   s
     "!r   c                 ,    |                      |          S )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   s     r   r   zSchedule._tf_value_op=   s     {{1~~r   N)__name__
__module____qualname____doc__r   r   intr	   r   r   r   r   r   r    r   r   r   r      s         # # #uS*_- #    %Z0 S     
"c:o. 
"3 
" 
" 
" ^
"j Z      r   r   )	metaclassN)abcr   r   typingr   r   ray.rllib.utils.annotationsr   ray.rllib.utils.frameworkr   ray.rllib.utils.typingr	   tf1r   tfvr   r%   r   r   <module>r.      s    ' ' ' ' ' ' ' '         3 3 3 3 3 3 3 3 3 3 3 3 - - - - - -}R = = = = = = = = = = =r   