
    Ng                         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dS )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/html/ai-engine/env/lib/python3.11/site-packages/timm/layers/helpers.pyparsez_ntuple.<locals>.parse   sL    a122 	:a;M;M 	88OVAq\\"""     )r   r   s   ` r   _ntupler   
   s#    # # # # # Lr                  ?c                 |    |p|}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!      sS    $WI	3q7Q;//7:WDE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'   "   sg    a%'' D!HHAJEzz!u"x%r   )r   Nr   )__doc__	itertoolsr   collections.abcr   r   	to_1tuple	to_2tuple	to_3tuple	to_4tuple	to_ntupler!   r'   r   r   r   <module>r0      s                 GAJJ	GAJJ	GAJJ	GAJJ		   	  	  	  	  	 r   