
    kh                     t    d Z ddlmZ ddlZd Z ed      Z ed      Z ed      Z ed      Z	eZ
dd	Zd
 Zy)zI Layer/Module Helpers

Hacked together by / Copyright 2020 Ross Wightman
    )repeatNc                       fd}|S )Nc                     t        | t        j                  j                        rt        | t              st        |       S t        t        |             S )N)
isinstancecollectionsabcIterablestrtupler   )xns    O/var/www/teggl/fontify/venv/lib/python3.12/site-packages/timm/layers/helpers.pyparsez_ntuple.<locals>.parse   s:    a112:a;M8OVAq\""     )r   r   s   ` r   _ntupler   
   s    # Lr               c                 n    |xs |}t        |t        | |dz  z         |z  |z        }||| z  k  r||z  }|S )Nr   )maxint)vdivisor	min_valueround_limitnew_vs        r   make_divisibler      sJ    $WI	3q7Q;/7:WDEE{QLr   c                     t        | t        t        f      s| f} nt        |       } |t        |       z
  }|dk  r| d | S | | d   f|z  z   S )Nr   )r   r   listlen)r   r   pad_ns      r   extend_tupler%   "   sU    a%'D!HAJEz!u"x%r   )   Ng?)__doc__	itertoolsr   collections.abcr   r   	to_1tuple	to_2tuple	to_3tuple	to_4tuple	to_ntupler   r%   r   r   r   <module>r/      sL      AJ	AJ	AJ	AJ			 r   