
    Hh                         d dl Z d dlmZ d dlmZ d dlmZ ddlm	Z	  G d dej
                  Z G d de          ZdS )	    N)OrderedDict   )Pointc                   "     e Zd ZdZ fdZ xZS )PointModulezcPointModule
    placeholder, all module subclass from this will take Point in PointSequential.
    c                 :     t                      j        |i | d S N)super__init__)selfargskwargs	__class__s      S/data/cameron/tmprepos/clean_dreammesh/UniRig/src/model/pointcept/models/modules.pyr   zPointModule.__init__   s%    $)&)))))    )__name__
__module____qualname____doc__r   __classcell__r   s   @r   r   r      sB         * * * * * * * * *r   r   c                   <     e Zd ZdZ fdZd Zd ZddZd Z xZ	S )	PointSequentialzA sequential container.
    Modules will be added to it in the order they are passed in the constructor.
    Alternatively, an ordered dict of modules can also be passed in.
    c                 P   t                                                       t          |          dk    rRt          |d         t                    r7|d                                         D ]\  }}|                     ||           n8t          |          D ](\  }}|                     t          |          |           )|                                D ]R\  }}t          j
        dk     rt          d          || j        v rt          d          |                     ||           Sd S )Nr   r   )      zkwargs only supported in py36+zname exists.)r
   r   len
isinstancer   items
add_module	enumeratestrsysversion_info
ValueError_modules)r   r   r   keymoduleidxnamer   s          r   r   zPointSequential.__init__   s!   t99>>ja+>>>#Aw}} - -VV,,,,-  ) 2 2VC&1111"LLNN 	* 	*LD&&(( !ABBBt}$$ 000OOD&))))	* 	*r   c                 v   t          |            |cxk    rt          |           k     s$n t          d                    |                    |dk     r|t          |           z  }t          | j                                                  }t          |          D ]}t          |           t          |          S )Nzindex {} is out of ranger   )r   
IndexErrorformatiterr&   valuesrangenext)r   r)   itis       r   __getitem__zPointSequential.__getitem__&   s    T
c----CII----7>>sCCDDD773t99C$-&&(())s 	 	AHHHHBxxr   c                 *    t          | j                  S r	   )r   r&   )r   s    r   __len__zPointSequential.__len__0   s    4=!!!r   Nc                     |9t          t          | j                            }|| j        v rt          d          |                     ||           d S )Nzname exists)r"   r   r&   KeyErrorr    )r   r(   r*   s      r   addzPointSequential.add3   sS    <s4=))**Dt}$$}---f%%%%%r   c                    | j                                         D ]S\  }}t          |t                    r ||          }'t          j                            |          rHt          |t                    r' ||j                  |_        |j        j	        |_
         ||          }t          |t                    rP ||j
                  |_
        d|                                v r$|j                            |j
                  |_        t          |t          j                  r;|j        j        d         dk    r#|                     ||j	                            }H ||          }U|S )Nsparse_conv_featr   )r&   r   r   r   spconvmodulesis_spconv_moduler   r;   featuresfeatkeysreplace_featureSparseConvTensorindicesshape)r   inputkr(   s       r   forwardzPointSequential.forward:   s\   ,,.. 	* 	*IAv&+.. *u0088 *eU++ *-3VE4J-K-KE*!&!7!@EJJ"F5MMEE eU++ 
*!'
!3!3EJ)UZZ\\99161G1W1W!J2 2.  v'>?? *}*1-22 % 5 5ffU^6L6L M M"F5MMEEr   r	   )
r   r   r   r   r   r4   r6   r9   rH   r   r   s   @r   r   r      s         
* * * * *  " " "& & & &      r   r   )r#   torch.nnnnspconv.pytorchpytorchr<   collectionsr   utils.structurer   Moduler   r    r   r   <module>rQ      s    



             # # # # # # " " " " " "* * * * *") * * *B B B B Bk B B B B Br   