ó
    Këgj:  ã                   ór  • S r SSKrSSKJr  SSKJr  \" S/S9           SS\R                  S\R                  S-  S\R                  S-  S	\R                  S-  S
\R                  S-  S\S-  S\S-  S\S-  S\R                  S-  S\R                  S-  S\R                  S-  S\S-  4S jj5       r
g)z4Main interface for causal 1D convolution operations.é    N)ÚFLACPContext)Úinput_guardÚx)Úno_guard_contiguousÚweightÚbiasÚresidualÚinitial_stateÚoutput_final_stateÚ
activationÚbackendÚ
cu_seqlensÚcu_seqlens_cpuÚchunk_indicesÚ
cp_contextc                 ób  • SSK Jn  SSKJnJn  SSKJn  Ub%  Ub   S5       eUSL d   S5       eU" U UUUU
US	9nUS4$ US
:X  a!  UR                  U UUUUUUUU	U
5
      u  nnUU4$ US:X  a!  UR                  S5      nU" U UUUUUUUU	U
US9$ US:X  a  U" U UUUUUUU4SU	0UD6$ [        SU 35      e)uv  
A causal 1D convolution implementation that powers Mamba/Mamba2 and DeltaNet architectures.

When a residual connection is provided, this implements the Canon operation
described in the paper at https://papers.ssrn.com/sol3/papers.cfm?abstract_id=5240330.

Args:
    x (torch.Tensor):
        Input tensor of shape [B, T, D].
    weight (Optional[torch.Tensor]):
        Weight tensor of shape [D, W]. Default: `None`.
    bias (Optional[torch.Tensor]):
        Bias tensor of shape [D]. Default: `None`.
    residual (Optional[torch.Tensor]):
        Residual tensor of shape [B, T, D]. Default: `None`.
    initial_state (Optional[torch.Tensor]):
        Initial state tensor of shape [N, D, W],
        where `N` is the number of sequences in the batch and `W` is the kernel size.
        If provided, the initial state is used to initialize the cache. Default: `None`.
    output_final_state (Optional[bool]):
        Whether to output the final state of shape [N, D, W]. Default: `False`.
    activation (Optional[str]):
        Activations applied to output, only `swish`/`silu` or `None` (i.e., no activation) are supported.
        Default: `None`.
    backend (Optional[str]):
        Specifies the backend to use for the convolution operation. Supported values are `'cuda'` ã€� `'triton'` and `'mix'`.
        Default: `'triton'`.
    cu_seqlens (Optional[torch.Tensor]):
        Cumulative sequence lengths (optional)
    chunk_indices (Optional[torch.LongTensor]):
        Chunk indices for variable-length sequences (optional)

Returns:
    Tuple of (output, final_state).
    If `output_final_state` is `False`, the final state is `None`.
r   )Úcausal_conv1d_cp)Úcausal_conv1d_cudaÚfast_causal_conv1d_fn)ÚCausalConv1dFunctionNz%Initial state is not supported for CPFz*Output final state is not supported for CP)r   r   r   r   r   r   ÚtritonÚmixÚseq_idx)r   r   r   Úcudar   zUnsupported backend: )
Úfla.modules.conv.cpr   Úfla.modules.conv.cudar   r   Úfla.modules.conv.tritonr   ÚapplyÚgetÚ
ValueError)r   r   r   r	   r
   r   r   r   r   r   r   r   Úkwargsr   r   r   r   ÚoutputÚyÚfinal_stater   s                        Ú¬C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\fla/modules/conv/causal_conv1d.pyÚcausal_conv1dr&      sD  € õj 5ßOÝ<àÑØÑ$ÐMÐ&MÓMÐ$Ø! UÒ*ÐXÐ,XÓXÐ*Ù!ØØØØ!Ø'Ø!ñ
ˆð �tˆ|Ðà�(ÓØ-×3Ñ3ØØØØØØØØØØó
‰ˆˆ;ð �+ˆ~ÐØ	�EÓ	Ø—*‘*˜YÓ'ˆÙ$ØØØØØØØØØ)Ø'Øñ
ð 	
ð 
�FÓ	Ù!ØØØØØØØØñ
ð *ð
ð ñ
ð 	
ô Ð0°°	Ð:Ó;Ð;ó    )NNNNFNr   NNNN)Ú__doc__ÚtorchÚ
fla.ops.cpr   Ú	fla.utilsr   ÚTensorÚboolÚstrÚ
LongTensorr&   © r'   r%   Ú<module>r1      s+  ðñ ;ã å #Ý !ñ  # Ñ'ð #'Ø $Ø$(Ø)-Ø&+Ø!Ø"Ø&*Ø.2Ø-1Ø&*ñp<Ø‡|�|ðp<à�L‰L˜4Ñðp<ð �,‰,˜Ñ
ðp<ð �l‰l˜TÑ!ð	p<ð
 —<‘< $Ñ&ðp<ð ˜t™ðp<ð �d‘
ðp<ð �4‰Zðp<ð —‘˜tÑ#ðp<ð ×$Ñ$ tÑ+ðp<ð ×#Ñ# dÑ*ðp<ð ˜tÑ#ôp<ó (ñp<r'   