
    )`i4                     r    d Z ddlmZmZ ddlmZmZ ddlmZm	Z	  G d de          Z
 G d d	e
          Zd
S )a3  
Copyright (c) 2025 by FlashInfer team.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    )ABCabstractmethod)AnyDict   )TaggedTensor
TensorTypec                   r    e Zd ZU dZeed<   dZeed<   d Zede	de
de	fd            Zde	defd	Zdefd
ZdS )OpNINOUTc                 \    | j         | j        t          d| j        j         d          d S )N	Operator z$ must define IN and OUT tensor types)r   r   
ValueError	__class____name__selfs    r/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/flashinfer/logits_processor/op.py__init__zOp.__init__   s=    7?dh.YDN3YYY   /.    tensorkwargsreturnc                     t           N)NotImplementedError)r   r   r   s      r   __call__zOp.__call__!   s    !!r   c                     |j         | j        k    r,t          d| j        j         d|j          d| j                   | j        S )Nr   z cannot accept input type z. Expected: )typer   r   r   r   r   )r   r   s     r   _validate_input_typezOp._validate_input_type%   s_    ;$'!!'DN3 ' 'v{ ' '!W' '   xr   c                 @    | j         j         d| j         d| j         dS )N(z -> ))r   r   r   r   r   s    r   __repr__zOp.__repr__-   s*    .)DDDGDDDDDDr   )r   
__module____qualname__r   r	   __annotations__r   r   r   r   r   r   r!   strr%    r   r   r   r      s         B
C   "| "s "| " " " ^"< J    E# E E E E E Er   r   c            	       P     e Zd Zdef fdZ	 d	dedeeef         dedefdZ xZ	S )
ParameterizedOpdefault_paramsc                 V    t                                                       || _        d S r   )superr   r-   )r   r-   r   s     r   r   zParameterizedOp.__init__2   s'    ,r   Tnamer   requiredr   c                     ||v r|                     |          S || j        v r| j        |         S |rt          d| d| j        j                   d S )NzRequired parameter 'z' not provided for )popr-   r   r   r   )r   r0   r   r1   s       r   
_get_paramzParameterizedOp._get_param6   st     6>>::d###T(((&t,, 	YtYY@WYY   4r   )T)
r   r&   r'   r   r   r)   r   boolr4   __classcell__)r   s   @r   r,   r,   1   s        - - - - - - -
 CG !%c3h;?	       r   r,   N)__doc__abcr   r   typingr   r   typesr   r	   r   r,   r*   r   r   <module>r;      s      $ # # # # # # #         + + + + + + + +E E E E E E E E4    b     r   