Ë
    éÓ^jâ  ã                   ó   — d Z ddlZdd„Zd„ Zy)zC Batch size decay and retry helpers.

Copyright 2022 Ross Wightman
é    Nc                 óÞ   — | dk  ryt        dt        j                  | dz
  «      t        j                  d«      z  z  «      }t        ||z  d«      }|| |z
  dz
  |z  |z  z   } |r
| dz  r| dz  } | S )ay   power of two batch-size decay with intra steps

    Decay by stepping between powers of 2:
    * determine power-of-2 floor of current batch size (base batch size)
    * divide above value by num_intra_steps to determine step size
    * floor batch_size to nearest multiple of step_size (from base batch size)
    Examples:
     num_steps == 4 --> 64, 56, 48, 40, 32, 28, 24, 20, 16, 14, 12, 10, 8, 7, 6, 5, 4, 3, 2, 1
     num_steps (no_odd=True) == 4 --> 64, 56, 48, 40, 32, 28, 24, 20, 16, 14, 12, 10, 8, 6, 4, 2
     num_steps == 2 --> 64, 48, 32, 24, 16, 12, 8, 6, 4, 3, 2, 1
     num_steps == 1 --> 64, 32, 16, 8, 4, 2, 1
    é   r   é   )ÚintÚmathÚlogÚmax)Ú
batch_sizeÚnum_intra_stepsÚno_oddÚbase_batch_sizeÚ	step_sizes        úa/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/timm/utils/decay_batch.pyÚdecay_batch_stepr      s   € ð �Q‚àÜ˜!¤§¡¨°a©Ó 8¼D¿H¹HÀQ»KÑ GÑHÓI€OÜ�O Ñ6¸Ó:€IØ  Z°/Ñ%AÀAÑ%EÈ)Ñ$SÐW`Ñ#`Ñ`€JÙ�*˜q’.Ø�a‰ˆ
ØÐó    c                 ó8   — | j                  «       } d| v ryd| v ryy)z_ check failure error string for conditions where batch decay retry should not be attempted
    zrequired rankFÚillegalT)Úlower)Ú	error_strs    r   Úcheck_batch_size_retryr       s+   € ð —‘Ó!€IØ˜)Ñ#ð Ø�IÑàØr   )r   F)Ú__doc__r   r   r   © r   r   ú<module>r      s   ðñó óó0r   