
    ni                     z    S r SSKJr  SSKJr  SSKJr  SSKrSSKr SSKJ	s  J
r  SS jrg! \ a    SSKr Nf = f)zCount learnable parameters.    )absolute_import)division)print_functionNc                    U (       a  U R                  S5      (       a  U OU S-   n U=(       d    [        R                  " 5       nUR                  [        R                  R
                  5      nU (       a3  U Vs/ s H&  oDR                  R                  U 5      (       d  M$  UPM(     nnU(       aI  [        R                  " U5      nU Vs/ s H&  oAR                  UR                  5      (       a  M$  UPM(     nnU Vs/ s H   oDR                  5       R                  5       PM"     nn[        [        S U 5       5      5      $ s  snf s  snf s  snf )a  Count learnable parameters.

Args:
  scope: Resrict the count to a variable scope.
  exclude: Regex to match variable names to exclude.
  graph: Operate on a graph other than the current default graph.

Returns:
  Number of learnable parameters as integer.
/c              3   N   #    U  H  n[         R                  " U5      v   M     g 7f)N)npprod).0shapes     b/home/james-whalen/.local/lib/python3.13/site-packages/pybullet_envs/agents/tools/count_weights.py	<genexpr> count_weights.<locals>.<genexpr>2   s     4VEVs   #%)endswithtfget_default_graphget_collection	GraphKeysTRAINABLE_VARIABLESname
startswithrecompilematch	get_shapeas_listintsum)scopeexcludegraphvars_varshapess         r   count_weightsr%      s     ^^C((EeckE

)2'')%


r||??
@%
!@ESXX%8%8%?SEE@jj!G!AESsxx)@SEEA167#MMO##%&7	S4V44	55 A B7s   7#D>D>#E.E:'E)NNN)__doc__
__future__r   r   r   r   numpyr	   tensorflow.compat.v1compatv1r   	Exception
tensorflowr%        r   <module>r0      s=    " &  % 	 ##
6	  s   	- 
::