o
    پiv                     @   s  d Z ddlmZ ddlmZmZmZmZ ddlZddl	m
Z
 ddlm
  mZ ddlmZ ddlmZmZ ddlmZmZmZmZmZmZmZ ddlmZmZ d	d
lmZ d	dlmZ d	dl m!Z! d	dl"m#Z#m$Z$ d	dl%m&Z&m'Z' dgZ(G dd de
j)Z*G dd de
j)Z+G dd de
j)Z,G dd de
j)Z-G dd de
j)Z.G dd de
j)Z/dedee0e0f fddZ1e!d edee0e0f d!e0d"e0fd#d$Z2G d%d& d&e
j)Z3G d'd( d(e
j)Z4G d)d* d*e
j)Z5G d+d de
j)Z6dOd-d.Z7d/d0 Z8dPd2d3Z9dQd5d6Z:e&e:d7d8e:d7d8e:d7d8e: e: e: e:d9dd:d;e:d<dd:d;d=Z;e'dPd>e6fd?d@Z<e'dPd>e6fdAdBZ=e'dPd>e6fdCdDZ>e'dPd>e6fdEdFZ?e'dPd>e6fdGdHZ@e'dPd>e6fdIdJZAe'dPd>e6fdKdLZBe'dPd>e6fdMdNZCdS )Raf   DaViT: Dual Attention Vision Transformers

As described in https://arxiv.org/abs/2204.03645

Input size invariant transformer architecture that combines channel and spacial
attention in each block. The attention mechanisms used are linear in complexity.

DaViT model defs and weights adapted from https://github.com/dingmyu/davit, original copyright below

    )partial)ListOptionalTupleUnionN)TensorIMAGENET_DEFAULT_MEANIMAGENET_DEFAULT_STD)DropPath	to_2tupletrunc_normal_MlpLayerNorm2dget_norm_layeruse_fused_attn)NormMlpClassifierHeadClassifierHead   )build_model_with_cfg)feature_take_indices)register_notrace_function)
checkpointcheckpoint_seq)generate_default_cfgsregister_modelDaVitc                       s:   e Zd Zddededef fddZdefd	d
Z  ZS )
ConvPosEnc   Fdimkactc                    sJ   t t|   tj|||d|d |d| _|rt | _d S t | _d S )Nr      )kernel_sizestridepaddinggroups)	superr   __init__nnConv2dprojGELUIdentityr!   )selfr   r    r!   	__class__ E/home/ubuntu/.local/lib/python3.10/site-packages/timm/models/davit.pyr(   #   s    zConvPosEnc.__init__xc                 C   s   |  |}|| | }|S N)r+   r!   )r.   r3   featr1   r1   r2   forward0   s   
zConvPosEnc.forward)r   F)	__name__
__module____qualname__intboolr(   r   r6   __classcell__r1   r1   r/   r2   r   "   s    r   c                       s8   e Zd ZdZdddef fdd	Zdefdd	Z  ZS )
Stemz Size-agnostic implementation of 2D image to patch embedding,
        allowing input size to be adjusted during model forward operation
    r   `      c                    sX   t    t|}|| _|| _|| _|d dksJ tj||d|dd| _||| _	d S )Nr   r?      r   r#   r$   r%   )
r'   r(   r   r$   in_chsout_chsr)   r*   convnorm)r.   rB   rC   r$   
norm_layerr/   r1   r2   r(   ;   s   
zStem.__init__r3   c                 C   s~   |j \}}}}| jd || jd   | jd  }| jd || jd   | jd  }t|d|d|f}| |}| |}|S )Nr   r   )shaper$   FpadrD   rE   )r.   r3   BCHWpad_rpad_br1   r1   r2   r6   Q   s   ""

zStem.forward)	r7   r8   r9   __doc__r   r(   r   r6   r<   r1   r1   r/   r2   r=   6   s    r=   c                       s0   e Zd Zdef fdd	ZdefddZ  ZS )
Downsampler   c                    sV   t    || _|| _||| _|d dk| _tj|||d| jr"dn|d d| _d S )Nr"   r   rA   )	r'   r(   rB   rC   rE   even_kr)   r*   rD   )r.   rB   rC   r#   rF   r/   r1   r2   r(   \   s   

zDownsample.__init__r3   c           
      C   sl   |j \}}}}| |}| jr/| jj\}}|||  | }|||  | }	t|d|d|	f}| |}|S )Nr   )rG   rE   rR   rD   r#   rH   rI   )
r.   r3   rJ   rK   rL   rM   k_hk_wrN   rO   r1   r1   r2   r6   q   s   

zDownsample.forward)r7   r8   r9   r   r(   r   r6   r<   r1   r1   r/   r2   rQ   [   s
    rQ   c                       s&   e Zd Zd fdd	Zdd Z  ZS )ChannelAttentionV2   Tc                    sH   t    || _|| | _|| _tj||d |d| _t||| _d S )Nr   bias)	r'   r(   r&   head_dimdynamic_scaler)   Linearqkvr+   )r.   r   	num_headsqkv_biasrZ   r/   r1   r2   r(      s   

zChannelAttentionV2.__init__c           
      C   s   |j \}}}| |||d| j|| j ddddd}|d\}}}| jr/||d  }n|| jd  }|dd| }	|	j	dd	}	|	|dd dd}|dd|||}| 
|}|S )
Nr   r"   r   r   r?         r   )rG   r\   reshaper&   permuteunbindrZ   rY   	transposesoftmaxr+   
r.   r3   rJ   NrK   r\   qr    vattnr1   r1   r2   r6      s   .
zChannelAttentionV2.forward)rV   TT)r7   r8   r9   r(   r6   r<   r1   r1   r/   r2   rU   }   s    	rU   c                       s,   e Zd Zd fdd	ZdefddZ  ZS )	ChannelAttentionrV   Fc                    sJ   t    || _|| }|d | _tj||d |d| _t||| _d S )Nr_   r   rW   )r'   r(   r]   scaler)   r[   r\   r+   )r.   r   r]   r^   rY   r/   r1   r2   r(      s   

zChannelAttention.__init__r3   c           
      C   s   |j \}}}| |||d| j|| j ddddd}|d\}}}|| j }|dd| }	|	jdd}	|	|dd dd}|dd|||}| 	|}|S )	Nr   r"   r   r   r?   r`   ra   rb   )
rG   r\   rc   r]   rd   re   rn   rf   rg   r+   rh   r1   r1   r2   r6      s   .

zChannelAttention.forward)rV   F)r7   r8   r9   r(   r   r6   r<   r1   r1   r/   r2   rm      s    	rm   c                       s@   e Zd Zdddejejdddf fdd	Zdefdd	Z  Z	S )
ChannelBlock      @F        Tc                    s   t    t|d|	d| _|| _||| _|
rtnt}||||d| _|dkr+t	|nt
 | _t|d|	d| _| jr^||| _t|t|| |d| _|dkrWt	|| _d S t
 | _d S d | _d | _d | _d S Nr   )r   r    r!   )r]   r^   rq   )in_featureshidden_features	act_layer)r'   r(   r   cpe1ffnnorm1rU   rm   rl   r   r)   r-   
drop_path1cpe2norm2r   r:   mlp
drop_path2)r.   r   r]   	mlp_ratior^   	drop_pathru   rF   rw   cpe_actv2
attn_layerr/   r1   r2   r(      s.   



$
zChannelBlock.__init__r3   c                 C   s   |j \}}}}| |ddd}| |}| |}|| | }| |dd||||}| j	d urZ|ddd}|| 
| 	| | }|dd||||}|S )Nr"   r   )rG   rv   flattenrf   rx   rl   ry   rz   viewr|   r}   r{   )r.   r3   rJ   rK   rL   rM   curr1   r1   r2   r6      s   


zChannelBlock.forward)
r7   r8   r9   r)   r,   	LayerNormr(   r   r6   r<   r1   r1   r/   r2   ro      s    (ro   r3   window_sizec                 C   sj   | j \}}}}| |||d  |d ||d  |d |} | dddddd d|d |d |}|S )z
    Args:
        x: (B, H, W, C)
        window_size (int): window size
    Returns:
        windows: (num_windows*B, window_size, window_size, C)
    r   r   r   r"   r?      r`   rG   r   rd   
contiguous)r3   r   rJ   rL   rM   rK   windowsr1   r1   r2   window_partition   s   ,,r   r   rL   rM   c                 C   s^   | j d }| d||d  ||d  |d |d |}|dddddd d|||}|S )z
    Args:
        windows: (num_windows*B, window_size, window_size, C)
        window_size (int): Window size
        H (int): Height of image
        W (int): Width of image
    Returns:
        x: (B, H, W, C)
    r`   r   r   r   r"   r?   r   r   )r   r   rL   rM   rK   r3   r1   r1   r2   window_reverse  s   
,$r   c                       sB   e Zd ZU dZejje ed< d	 fdd	Z	de
fddZ  ZS )
WindowAttentiona   Window based multi-head self attention (W-MSA) module with relative position bias.
    It supports both of shifted and non-shifted window.
    Args:
        dim (int): Number of input channels.
        window_size (tuple[int]): The height and width of the window.
        num_heads (int): Number of attention heads.
        qkv_bias (bool, optional):  If True, add a learnable bias to query, key, value. Default: True
    
fused_attnTc                    sl   t    || _|| _|| _|| }|d | _t | _tj	||d |d| _
t	||| _tjdd| _d S )Nr_   r   rW   r`   rb   )r'   r(   r   r   r]   rn   r   r   r)   r[   r\   r+   Softmaxrg   )r.   r   r   r]   r^   rY   r/   r1   r2   r(     s   

zWindowAttention.__init__r3   c           
      C   s   |j \}}}| |||d| j|| j ddddd}|d\}}}| jr0t|||}n|| j	 }||
dd }	| |	}	|	| }|
dd|||}| |}|S )Nr   r"   r   r   r?   ra   r`   )rG   r\   rc   r]   rd   re   r   rH   scaled_dot_product_attentionrn   rf   rg   r+   )
r.   r3   B_ri   rK   r\   rj   r    rk   rl   r1   r1   r2   r6   +  s   .


zWindowAttention.forwardT)r7   r8   r9   rP   torchjitFinalr;   __annotations__r(   r   r6   r<   r1   r1   r/   r2   r     s
   
 r   c                       sD   e Zd ZdZddddejejddf fdd	Zd	efd
dZ	  Z
S )SpatialBlocka<   Windows Block.
    Args:
        dim (int): Number of input channels.
        num_heads (int): Number of attention heads.
        window_size (int): Window size.
        mlp_ratio (float): Ratio of mlp hidden dim to embedding dim.
        qkv_bias (bool, optional): If True, add a learnable bias to query, key, value. Default: True
        drop_path (float, optional): Stochastic depth rate. Default: 0.0
        act_layer (nn.Module, optional): Activation layer. Default: nn.GELU
        norm_layer (nn.Module, optional): Normalization layer.  Default: nn.LayerNorm
    r@   rp   Trq   Fc                    s   t    || _|	| _|| _t|| _|| _t|d|
d| _	||| _
t|| j||d| _|dkr5t|nt | _t|d|
d| _| jrj||| _t|| }t|||d| _|dkrct|| _d S t | _d S d | _d | _d | _d S rr   )r'   r(   r   rw   r]   r   r   r~   r   rv   rx   r   rl   r   r)   r-   ry   rz   r{   r:   r   r|   r}   )r.   r   r]   r   r~   r^   r   ru   rF   rw   r   mlp_hidden_dimr/   r1   r2   r(   K  s8   



$
zSpatialBlock.__init__r3   c              	   C   s  |j \}}}}| |ddd}| |}|||||}d }}| jd || jd   | jd  }	| jd || jd   | jd  }
t|dd||	||
f}|j \}}}}t	|| j}|d| jd | jd  |}| 
|}|d| jd | jd |}t|| j||}|d d d |d |d d f  }|||| |}|| | }| |dd||||}| jd ur|ddd}|| | | | }|dd||||}|S )Nr"   r   r   r`   )rG   rv   r   rf   rx   r   r   rH   rI   r   rl   r   r   ry   rz   r|   r}   r{   )r.   r3   rJ   rK   rL   rM   shortcutpad_lpad_trN   rO   _HpWp	x_windowsattn_windowsr1   r1   r2   r6   x  s.   
""
$
zSpatialBlock.forward)r7   r8   r9   rP   r)   r,   r   r(   r   r6   r<   r1   r1   r/   r2   r   >  s    -r   c                       s^   e Zd Zddddddddeejddd	ddf fd
d	Zejj	dddZ
defddZ  ZS )
DaVitStager   Tspatialchannelr   r@   rp   )r   r   Fr"   c                    s  t    d| _|rt||||d| _nt | _	 g }t|D ]^}ddlm	} g }t
|D ]5\}}|dkrK|dt||||	|
| ||||d	f q.|dkrc|d	t||||	|
| ||||d
	f q.|rq|t|| q |tjdd |D   q tj| | _d S )NF)r#   rF   r   )OrderedDictr   spatial_block)	r   r]   r~   r^   r   rF   rw   r   r   r   channel_block)	r   r]   r~   r^   r   rF   rw   r   r   c                 S   s   g | ]}|d  qS )r   r1   ).0br1   r1   r2   
<listcomp>      z'DaVitStage.__init__.<locals>.<listcomp>)r'   r(   grad_checkpointingrQ   
downsampler)   r-   rangecollectionsr   	enumerateappendr   ro   
Sequentialblocks)r.   rB   rC   depthr   
attn_typesr]   r   r~   r^   drop_path_ratesrF   norm_layer_clrw   r   down_kernel_sizenamed_blockschannel_attn_v2stage_blocks	block_idxr   dual_attention_blockattn_idx	attn_typer/   r1   r2   r(     sP   


zDaVitStage.__init__c                 C   s
   || _ d S r4   )r   )r.   enabler1   r1   r2   set_grad_checkpointing  s   
z!DaVitStage.set_grad_checkpointingr3   c                 C   s8   |  |}| jrtj st| j|}|S | |}|S r4   )r   r   r   r   is_scriptingr   r   r.   r3   r1   r1   r2   r6     s   

zDaVitStage.forwardr   )r7   r8   r9   r   r)   r   r(   r   r   ignorer   r   r6   r<   r1   r1   r/   r2   r     s(    Hr   c                       sT  e Zd ZdZ										
												d7 fdd	Zdd Zejjd8ddZ	ejjd9ddZ
ejjdejfddZd:dedee fd d!Z				"	d;d#ejd$eeeee f  d%ed&ed'ed(edeeej eejeej f f fd)d*Z	+		d<d$eeee f d,ed-efd.d/Zd0d1 Zd8d2efd3d4Zd5d6 Z  ZS )=r   a   DaViT
        A PyTorch implementation of `DaViT: Dual Attention Vision Transformers`  - https://arxiv.org/abs/2204.03645
        Supports arbitrary input sizes and pyramid feature extraction

    Args:
        in_chans (int): Number of input image channels. Default: 3
        num_classes (int): Number of classes for classification head. Default: 1000
        depths (tuple(int)): Number of blocks in each stage. Default: (1, 1, 3, 1)
        embed_dims (tuple(int)): Patch embedding dimension. Default: (96, 192, 384, 768)
        num_heads (tuple(int)): Number of attention heads in different layers. Default: (3, 6, 12, 24)
        window_size (int): Window size. Default: 7
        mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4
        qkv_bias (bool): If True, add a learnable bias to query, key, value. Default: True
        drop_path_rate (float): Stochastic depth rate. Default: 0.1
        norm_layer (nn.Module): Normalization layer. Default: nn.LayerNorm.
    r   r   r   r   r   r>           r            r@   r?   Tlayernorm2d	layernormh㈵>r   Fr"   rq     avgc                    s  t    t|}|t|  krt|ksJ  J tt||
d}tt|	|
d}	|| _|d  | _| _|| _d| _	g | _
t||d |d| _|d }dd td|t||D }g }t|D ]@}|| }t||f|| |dk||| ||||| ||	|||||d}|}|| |  j
t|d	|d	  d
| dg7  _
qdtj| | _|r|| j| _t| j||| jd| _nt | _t| j||| j|d| _| | j d S )N)epsr`   Fr   )rF   c                 S   s   g | ]}|  qS r1   )tolist)r   r3   r1   r1   r2   r   .  r   z"DaVit.__init__.<locals>.<listcomp>)r   r   r   r]   r   r~   r^   r   rF   r   rw   r   r   r   r   r"   zstages.)num_chs	reductionmodule)	pool_type	drop_rate)r   r   rF   )r'   r(   lenr   r   num_classesnum_featureshead_hidden_sizer   r   feature_infor=   stemr   linspacesumsplitr   r   r   dictr)   r   stagesnorm_prer   headr-   r   apply_init_weights)r.   in_chansdepths
embed_dimsr]   r   r~   r^   rF   r   norm_epsr   rw   r   r   r   r   r   drop_path_rater   global_poolhead_norm_first
num_stagesrB   dprr   irC   stager/   r1   r2   r(     sr   
$"
*

zDaVit.__init__c                 C   sP   t |tjr"t|jdd t |tjr$|jd ur&tj|jd d S d S d S d S )Ng{Gz?)stdr   )
isinstancer)   r[   r   weightrX   init	constant_)r.   mr1   r1   r2   r   a  s   zDaVit._init_weightsc                 C   s   t d|rddS g ddS )Nz^stemz^stages\.(\d+)))z^stages\.(\d+).downsample)r   )z^stages\.(\d+)\.blocks\.(\d+)N)z	^norm_pre)i )r   r   )r   )r.   coarser1   r1   r2   group_matcherg  s   zDaVit.group_matcherc                 C   s"   || _ | jD ]}|j|d qd S )N)r   )r   r   r   )r.   r   r   r1   r1   r2   r   r  s   
zDaVit.set_grad_checkpointingreturnc                 C   s   | j jS r4   )r   fc)r.   r1   r1   r2   get_classifierx  s   zDaVit.get_classifierNr   r   c                 C   s   || _ | j|| d S r4   )r   r   reset)r.   r   r   r1   r1   r2   reset_classifier|  s   zDaVit.reset_classifierNCHWr3   indicesrE   
stop_early
output_fmtintermediates_onlyc                 C   s   |dv sJ dg }t t| j|\}}	| |}t| jd }
tj s'|s+| j}n	| jd|	d  }t|D ]-\}}| jrJtj sJt	||}n||}||v re|r^||
kr^| 
|}n|}|| q8|rj|S ||
krs| 
|}||fS )a   Forward features that returns intermediates.

        Args:
            x: Input image tensor
            indices: Take last n blocks if int, all if None, select matching indices if sequence
            norm: Apply norm layer to compatible intermediates
            stop_early: Stop iterating over blocks when last desired intermediate hit
            output_fmt: Shape of intermediate feature outputs
            intermediates_only: Only return intermediate features
        Returns:

        )r  zOutput shape must be NCHW.r   N)r   r   r   r   r   r   r   r   r   r   r   r   )r.   r3   r  rE   r  r  r  intermediatestake_indices	max_indexlast_idxr   feat_idxr   x_interr1   r1   r2   forward_intermediates  s.   


zDaVit.forward_intermediatesr   
prune_norm
prune_headc                 C   sJ   t t| j|\}}| jd|d  | _|rt | _|r#| dd |S )z@ Prune layers not required for specified intermediates.
        Nr   r    )r   r   r   r)   r-   r   r  )r.   r  r  r  r  r	  r1   r1   r2   prune_intermediate_layers  s   
zDaVit.prune_intermediate_layersc                 C   s@   |  |}| jrtj st| j|}n| |}| |}|S r4   )r   r   r   r   r   r   r   r   r   r1   r1   r2   forward_features  s   


zDaVit.forward_features
pre_logitsc                 C   s   |r	| j |ddS |  |S )NT)r  )r   )r.   r3   r  r1   r1   r2   forward_head  s   zDaVit.forward_headc                 C   s   |  |}| |}|S r4   )r  r  r   r1   r1   r2   r6     s   

zDaVit.forward)r   r   r   r   r@   r?   Tr   r   r   r   TFr"   FFrq   rq   r   r   FFr   r4   )NFFr  F)r   FT)r7   r8   r9   rP   r(   r   r   r   r   r   r   r)   Moduler   r:   r   strr  r   r   r   r;   r   r  r  r  r  r6   r<   r1   r1   r/   r2   r     s    Y
 
7
	vision_tower.c                 C   s   dd l }i }|  D ]_\}}||r||d}nq
|dd|}|dd|}|dd}|d	d
}|dd}|dd}|dd}|dd}|dd}|dd}|dd}|dd}|||< q
|S )Nr   r  zconvs.([0-9]+)stages.\1.downsamplezblocks.([0-9]+)stages.\1.blocksdownsample.projdownsample.convstages.0.downsampler   zwindow_attn.norm.znorm1.zwindow_attn.fn.zattn.zchannel_attn.norm.zchannel_attn.fn.z	ffn.norm.znorm2.zffn.fn.net.zmlp.zconv1.fn.dwz	cpe1.projzconv2.fn.dwz	cpe2.proj)reitems
startswithreplacesub)
state_dictmodelprefixr  out_dictr    rk   r1   r1   r2   _convert_florence2  s(   

r'  c                 C   s   d| v r| S d| v r| d } d| v rt | |S ddl}i }|  D ]:\}}|dd|}|dd	|}|d
d}|dd}|dd}|dd}|dd}|dd}|||< q!|S )z  Remap MSFT checkpoints -> timm zhead.fc.weightr#  z vision_tower.convs.0.proj.weightr   Nzpatch_embeds.([0-9]+)r  zmain_blocks.([0-9]+)r  r  r  r  r   zhead.zhead.fc.znorms.z
head.norm.zcpe.0rv   zcpe.1rz   )r'  r  r  r"  r!  )r#  r$  r  r&  r    rk   r1   r1   r2   checkpoint_filter_fn  s&   

r(  Fc                 K   sl   t dd t|ddD }|d|}|dd}| dr"d	}tt| |fttd|d
|d|}|S )Nc                 s   s    | ]\}}|V  qd S r4   r1   )r   r   r   r1   r1   r2   	<genexpr>  s    z _create_davit.<locals>.<genexpr>r   r   out_indicespretrained_strictT_flF)flatten_sequentialr*  )pretrained_filter_fnfeature_cfgr+  )	tupler   getpopendswithr   r   r(  r   )variant
pretrainedkwargsdefault_out_indicesr*  strictr$  r1   r1   r2   _create_davit  s"   

	r9  r  c                 K   s   | dddddt tddd
|S )	Nr   )r      r:  )r@   r@   gffffff?bicubicz	stem.convzhead.fc)
urlr   
input_size	pool_sizecrop_pctinterpolationmeanr   
first_conv
classifierr   )r<  r6  r1   r1   r2   _cfg"  s   rD  ztimm/)	hf_hub_idzmicrosoft/Florence-2-base)r   r   r   )rE  r   r=  zmicrosoft/Florence-2-large)zdavit_tiny.msft_in1kzdavit_small.msft_in1kzdavit_base.msft_in1kdavit_large
davit_hugedavit_giantzdavit_base_fl.msft_florence2zdavit_huge_fl.msft_florence2r   c                 K   ,   t dddd}tdd| it |fi |S )Nr   r   r   r   r   r]   
davit_tinyr5  )rK  r   r9  r5  r6  
model_argsr1   r1   r2   rK  B     rK  c                 K   rI  )Nr   r   	   r   r   r   rJ  davit_smallr5  )rR  rL  rM  r1   r1   r2   rR  H  rO  rR  c                 K   rI  )NrP              r?   rV          rJ  
davit_baser5  )r[  rL  rM  r1   r1   r2   r[  N  rO  r[  c                 K   rI  )NrP  )r   r   r      )r   r   r   0   rJ  rF  r5  )rF  rL  rM  r1   r1   r2   rF  T  rO  rF  c                 K   rI  )NrP  rU  rV  rW  i   rV   rY  rZ  @   rJ  rG  r5  )rG  rL  rM  r1   r1   r2   rG  Z  rO  rG  c                 K   rI  )N)r   r   r   r   )r   r   r\  i   )r   r   r]  r>   rJ  rH  r5  )rH  rL  rM  r1   r1   r2   rH  `  rO  rH  c              	   K   4   t dddddddd}td
d	| it |fi |S )NrP  rS  rX  r   r   Tr   r   r]   r   r   r   r   davit_base_flr5  )rc  rL  rM  r1   r1   r2   rc  g  s
   rc  c              	   K   ra  )NrP  r^  r_  r   r   Trb  davit_huge_flr5  )rd  rL  rM  r1   r1   r2   rd  p  s
   rd  )r  r  )r  )DrP   	functoolsr   typingr   r   r   r   r   torch.nnr)   torch.nn.functional
functionalrH   r   	timm.datar	   r
   timm.layersr   r   r   r   r   r   r   r   r   _builderr   	_featuresr   _features_fxr   _manipulater   r   	_registryr   r   __all__r  r   r=   rQ   rU   rm   ro   r:   r   r   r   r   r   r   r'  r(  r9  rD  default_cfgsrK  rR  r[  rF  rG  rH  rc  rd  r1   r1   r1   r2   <module>   s    $%"=$,bV 
b

