
    &`i                     x    d dl Zd dlmZ d dlmZ d dlmZ  e            \  ZZ	e G d de                      Z
dS )    N)try_import_torch)SeriesStats)DeveloperAPIc                   .    e Zd ZdZdZd Zd ZdefdZdS )MaxStatszPA Stats object that tracks the max of a series of singular values (not vectors).maxc                 *    t          j        |          S )N)npnanmax)selfvaluess     u/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/rllib/utils/metrics/stats/max.py_np_reduce_fnzMaxStats._np_reduce_fn   s    y       c                    |t                               |                    }t          |          dk    r.t                               t	          d          |j                  S t                               |                                          S )z1Reduce function for torch tensors (stays on GPU).r   nan)device)torchisnanlentensorfloatr   r   )r   r   clean_valuess      r   _torch_reduce_fnzMaxStats._torch_reduce_fn   sl     u{{62223|!!<<eV]<CCCyy++--...r   returnc                 b    d|                                   d| j         dt          |            dS )Nz	MaxStats(z	; window=z; len=))peek_windowr   )r   s    r   __repr__zMaxStats.__repr__   s3    Q499;;QQQQSYYQQQQr   N)	__name__
__module____qualname____doc__stats_cls_identifierr   r   strr     r   r   r   r   
   s`        ZZ ! ! !/ / /R# R R R R R Rr   r   )numpyr
   ray.rllib.utils.frameworkr   $ray.rllib.utils.metrics.stats.seriesr   ray.util.annotationsr   r   _r   r'   r   r   <module>r-      s        6 6 6 6 6 6 < < < < < < - - - - - -q R R R R R{ R R R R Rr   