o
    i                     @   s  d dl mZmZ d dlZddlmZmZmZm	Z	 ddl
mZ e deeef deeef defd	d
Ze deeef deeef defddZe deeef deeef defddZe dedede	fddZe deeeeef  ef dejdefddZdS )    )UnionTupleN   )	ShapeExpr
TensorDesc
ShapeExprsSizeTensorDesc)
public_apifirstsecondreturnc                 C   4   t | trt |trtdt| } | tjj|S )ap  
    Computes symbolic ceiling division of `first` by `second`

    Args:
        first (Union[int, ShapeExpr]): Dividend
        second (Union[int, ShapeExpr]): Divisor

    Raises:
        ValueError: If both arguments are `int`\s or if `second` evaluates to 0

    Returns:
        ShapeExpr: Symbolic expression for the ceiling division of `first` by `second`
    Both arguments cannot be 'int's)
isinstanceint
ValueErrorr   _optrtDimensionOperationCEIL_DIVr
   r    r   W/home/ubuntu/.local/lib/python3.10/site-packages/tensorrt_bindings/plugin/_top_level.pycdiv   
   

r   c                 C   r   )aI  
    Computes the maximum of `first` and `second`

    Args:
        first (Union[int, ShapeExpr]): First operand
        second (Union[int, ShapeExpr]): Second operand

    Raises:
        ValueError: If both arguments are `int`\s

    Returns:
        ShapeExpr: Symbolic expression for the maximum of `first` and `second`
    r   )r   r   r   r   r   r   r   MAXr   r   r   r   max2   r   r   c                 C   r   )aI  
    Computes the minimum of `first` and `second`

    Args:
        first (Union[int, ShapeExpr]): First operand
        second (Union[int, ShapeExpr]): Second operand

    Raises:
        ValueError: If both arguments are `int`\s

    Returns:
        ShapeExpr: Symbolic expression for the minimum of `first` and `second`
    r   )r   r   r   r   r   r   r   MINr   r   r   r   minJ   r   r   optupper_boundc                 C   s
   t | |S )a  
    Constructs a size tensor with the specified autotune shape expression `opt` and `upper_bound`

    Args:
        opt (ShapeExpr): Symbolic expression for the extent of this size tensor to use in the autotune process of the engine build
        upper_bound (ShapeExpr): Symbolic expression for the upper-bound of this size tensor

    Returns:
        SizeTensorDesc: A tensor descriptor for a size tensor with the specified autotune extent and upper-bound
    )r   )r   r    r   r   r   size_tensorb   s   
r!   
shape_exprdtypec                 C   s$   t | trt| }n| }t||S )a  
    Constructs a tensor descriptor with the specified shape expression and data type

    Args:
        shape_expr (Union[Tuple[Union[ShapeExpr, int]], ShapeExprs]): Expressions or constants denoting the shape of the tensor
        dtype (trt.DataType): Data type of the tensor

    Returns:
        TensorDesc: Tensor descriptor with the specified shape expression and data type
    )r   tupler   
from_tupler   )r"   r#   shape_expr_r   r   r   from_shape_exprq   s   

r'   )typingr   r   tensorrtr   _tensorr   r   r   r   _exportr	   r   r   r   r   r!   DataTyper'   r   r   r   r   <module>   s   (((2