o
    XiR                     @  s   d dl mZ d dlmZmZmZ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mZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZm Z  G dd	 d	eZ!d
S )    )annotations)OptionalSequenceTupleTypeVarUnion)
get_schema)	TypeAlias)Opset6)BOOL	COMPLEX64
COMPLEX128DOUBLEFLOATFLOAT16INT8INT16INT32INT64STRINGUINT8UINT16UINT32UINT64)OpOpsetc                   @  s  e Zd ZU dd ZedeeeZdddZ	edeeee
eeeZdddZeZded< eZded< dddZedeeeZdddZedeeeZdddZedeeeZddddddd'd(Zed)eeeZd*d+d,d-dd6d7Zed8eeeZdd9d:Zed;eeee
eeeZdd<d=Z ed>eeeZ!d?d@ddDdEZ"edFee
eZ#eZ$dedG< ddHdIZ%edJeeeZ&e
Z'dedK< 			ddddddLdddMdd`daZ(edbeeeZ)dcdcddddddjdkZ*edleeeZ+eZ,dedm< ddndoZ-edpeeeZ.e
Z/dedq< 					ddddddLdddrddydzZ0ed{eeeZ1eZ2ded|< dd}d~Z3edeeee
eeeZ4dddZ5edeeeZ6e7e
ef Z8ded< dd,dddddZ9eZ:ded< eZ;ded< dddZ<edeeeZ=dddZ>edeeeZ?dddZ@edeeeZAe
ZBded< 			ddddddLdddddZCedeeeZDdddZEedeeee
eeeZFdddZGedeeeZHdddZIedeeJeKeeeeLe
eeMeNeOeeePZQdddddZReZSded< eZTded< dddZUdS )Opset7c                 C  s   t | ddS )N    )r   __new__)cls r!   V/home/ubuntu/.local/lib/python3.10/site-packages/onnxscript/onnx_opset/_impl/opset7.pyr   *   s   zOpset7.__new__T_Acosinputreturnc                 C  (   t ddd}t| d|}|| || S )u  [🌐 Acos(7)](https://onnx.ai/onnx/operators/onnx__Acos.html#acos-7 "Online Documentation")


        Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise.


        Args:
            input: (differentiable) Input tensor
        Acosr   r   r   r   _prepare_inputsselfr$   schemaopr!   r!   r"   r'   /      zOpset7.AcosT_AddABc                 C  *   t ddd}t| d|}|| ||| S )u  [🌐 Add(7)](https://onnx.ai/onnx/operators/onnx__Add.html#add-7 "Online Documentation")


        Performs element-wise binary addition (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: First operand.

            B: Second operand.
        Addr   r   r(   r+   r0   r1   r,   r-   r!   r!   r"   r3   @      z
Opset7.Addr	   T_AndT1_Andc                 C  r2   )u  [🌐 And(7)](https://onnx.ai/onnx/operators/onnx__And.html#and-7 "Online Documentation")


        Returns the tensor resulted from performing the `and` logical operation
        elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: (non-differentiable) First input operand for the logical operator.

            B: (non-differentiable) Second input operand for the logical operator.
        Andr   r   r(   r4   r!   r!   r"   r8   W      z
Opset7.AndT_Asinc                 C  r&   )u  [🌐 Asin(7)](https://onnx.ai/onnx/operators/onnx__Asin.html#asin-7 "Online Documentation")


        Calculates the arcsine (inverse of sine) of the given input tensor, element-wise.


        Args:
            input: (differentiable) Input tensor
        Asinr   r   r(   r*   r!   r!   r"   r;   m   r.   zOpset7.AsinT_Atanc                 C  r&   )u  [🌐 Atan(7)](https://onnx.ai/onnx/operators/onnx__Atan.html#atan-7 "Online Documentation")


        Calculates the arctangent (inverse of tangent) of the given input tensor, element-wise.


        Args:
            input: (differentiable) Input tensor
        Atanr   r   r(   r*   r!   r!   r"   r=   ~   r.   zOpset7.AtanT_AveragePoolNOTSETr   N)auto_padcount_include_padpadsstridesXr@   strrA   intkernel_shapeSequence[int]rB   Optional[Sequence[int]]rC   c          	      C  s6   t ddd}t| d|}|| |||||||dS )uG  [🌐 AveragePool(7)](https://onnx.ai/onnx/operators/onnx__AveragePool.html#averagepool-7 "Online Documentation")


         AveragePool consumes an input tensor X and applies average pooling across
         the tensor according to kernel sizes, stride sizes, and pad lengths.
         average pooling consisting of computing the average on all values of a
         subset of the input tensor according to the kernel size and downsampling the
         data into the output tensor Y for further processing. The output spatial shape will be following:
         ```
         output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1)

         * pad_shape[i] is sum of pads along axis i
         ```

         `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following:
         ```
         VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - kernel_spatial_shape[i] + 1) / strides_spatial_shape[i])
         SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i])
         ```
         And pad shape will be following if `SAME_UPPER` or `SAME_LOWER`:
         ```
         pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + kernel_spatial_shape[i] - input_spatial_shape[i]
         ```
         The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero).


        Args:
            X: Input data tensor from the previous operator; dimensions for image case
                are (N x C x H x W), where N is the batch size, C is the number of
                channels, and H and W are the height and the width of the data. For non
                image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn),
                where N is the batch size. Optionally, if dimension denotation is in
                effect, the operation expects the input data tensor to arrive with the
                dimension denotation of [DATA_BATCH, DATA_CHANNEL, DATA_FEATURE,
                DATA_FEATURE ...].

            auto_pad: auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID.
                Where default value is NOTSET, which means explicit padding is used.
                SAME_UPPER or SAME_LOWER mean pad the input so that the output spatial
                size match the input.In case of odd number add the extra padding at the
                end for SAME_UPPER and at the beginning for SAME_LOWER. VALID mean no
                padding.

            count_include_pad: Whether include pad pixels when calculating values for
                the edges. Default is 0, doesn't count include pad.

            kernel_shape: The size of the kernel along each axis.

            pads: Padding for the beginning and ending along each spatial axis, it can
                take any value greater than or equal to 0. The value represent the
                number of pixels added to the beginning and end part of the
                corresponding axis. `pads` format should be as follow [x1_begin,
                x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels
                added at the beginning of axis `i` and xi_end, the number of pixels
                added at the end of axis `i`. This attribute cannot be used
                simultaneously with auto_pad attribute. If not present, the padding
                defaults to 0 along start and end of each spatial axis.

            strides: Stride along each spatial axis.
        AveragePoolr   r   )r@   rA   rG   rB   rC   r(   )	r+   rD   r@   rA   rG   rB   rC   r,   r-   r!   r!   r"   rJ      s   G
zOpset7.AveragePoolT_BatchNormalizationg   >g   ?   epsilonmomentumspatialscalemeanvarrN   floatrO   rP   sTuple[T_BatchNormalization, T_BatchNormalization, T_BatchNormalization, T_BatchNormalization, T_BatchNormalization]c             	   C  s:   t ddd}	t| d|	}
|
| |	||||||||dS )ug
  [🌐 BatchNormalization(7)](https://onnx.ai/onnx/operators/onnx__BatchNormalization.html#batchnormalization-7 "Online Documentation")


            Carries out batch normalization as described in the paper
            https://arxiv.org/abs/1502.03167. Depending on the mode it is being run,
            there are multiple cases for the number of outputs, which we list below:

            Output case #1: Y, mean, var, saved_mean, saved_var (training mode)
            Output case #2: Y (test mode)
                This operator has **optional** inputs/outputs. See `ONNX <https://github.com/onnx/onnx/blob/master/docs/IR.md>`_ for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted.


        Args:
            X: Input data tensor from the previous operator; dimensions for image case
                are (N x C x H x W), where N is the batch size, C is the number of
                channels, and H and W are the height and the width of the data. For non
                image case, the dimensions are in the form of (N x C x D1 x D2 ... Dn),
                where N is the batch size.

            scale: If spatial is true, the dimension of scale is (C). If spatial is
                false, the dimensions of scale are (C x D1 x ... x Dn)

            B: If spatial is true, the dimension of bias is (C). If spatial is false,
                the dimensions of bias are (C x D1 x ... x Dn)

            mean: If spatial is true, the dimension of the running mean (training) or
                the estimated mean (testing) is (C). If spatial is false, the dimensions
                of the running mean (training) or the estimated mean (testing) are (C x
                D1 x ... x Dn).

            var: If spatial is true, the dimension of the running variance(training) or
                the estimated variance (testing) is (C). If spatial is false, the
                dimensions of the running variance(training) or the estimated variance
                (testing) are (C x D1 x ... x Dn).

            epsilon: The epsilon value to use to avoid division by zero.

            momentum: Factor used in computing the running mean and variance.e.g.,
                running_mean = running_mean * momentum + mean * (1 - momentum).

            spatial: If true, compute the mean and variance across per activation. If
                false, compute the mean and variance across per feature over each
                mini-batch.
        BatchNormalizationr   r   rM   r(   )r+   rD   rQ   r1   rR   rS   rN   rO   rP   r,   r-   r!   r!   r"   rV      s   ?zOpset7.BatchNormalizationT_Cosc                 C  r&   )u   [🌐 Cos(7)](https://onnx.ai/onnx/operators/onnx__Cos.html#cos-7 "Online Documentation")


        Calculates the cosine of the given input tensor, element-wise.


        Args:
            input: (differentiable) Input tensor
        Cosr   r   r(   r*   r!   r!   r"   rX   -  r.   z
Opset7.CosT_Divc                 C  r2   )u  [🌐 Div(7)](https://onnx.ai/onnx/operators/onnx__Div.html#div-7 "Online Documentation")


        Performs element-wise binary division (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: First operand.

            B: Second operand.
        Divr   r   r(   r4   r!   r!   r"   rZ   >  r5   z
Opset7.Div	T_Dropoutg      ?)ratiodatar\   Tuple[T_Dropout, T_Dropout]c                C  s.   t ddd}t| d|}|| ||d|iS )u  [🌐 Dropout(7)](https://onnx.ai/onnx/operators/onnx__Dropout.html#dropout-7 "Online Documentation")


        Dropout takes one input data (Tensor<float>) and produces two Tensor outputs,
        output (Tensor<float>) and mask (Tensor<bool>). Depending on whether it is in
        test mode or not, the output Y will either be a random dropout, or a simple
        copy of the input. Note that our implementation of Dropout does scaling in
        the training phase, so during testing nothing needs to be done.
        This operator has **optional** inputs/outputs. See `ONNX <https://github.com/onnx/onnx/blob/master/docs/IR.md>`_ for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted.


        Args:
            data: The input data as Tensor.

            ratio: The ratio of random dropout
        Dropoutr   r   r\   r(   )r+   r]   r\   r,   r-   r!   r!   r"   r_   S  s   zOpset7.DropoutT_EqualT1_Equalc                 C  r2   )ut  [🌐 Equal(7)](https://onnx.ai/onnx/operators/onnx__Equal.html#equal-7 "Online Documentation")


        Returns the tensor resulted from performing the `equal` logical operation
        elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: First input operand for the logical operator.

            B: Second input operand for the logical operator.
        Equalr   r   r(   r4   r!   r!   r"   rb   m  r9   zOpset7.EqualT_GRUT1_GRUforwardactivation_alphaactivation_betaactivationsclip	directionhidden_sizelinear_before_resetWROptional[T_GRU]sequence_lensOptional[T1_GRU]	initial_hrg   Optional[Sequence[float]]rh   ri   Optional[Sequence[str]]rj   Optional[float]rk   rl   Optional[int]rm   Tuple[T_GRU, T_GRU]c             
   C  sD   t ddd}t| d|}|| ||||||||||	|
|||dS )u  [🌐 GRU(7)](https://onnx.ai/onnx/operators/onnx__GRU.html#gru-7 "Online Documentation")


        Computes an one-layer GRU. This operator is usually supported via some custom
        implementation such as CuDNN.

        Notations:

        `X` - input tensor

        `z` - update gate

        `r` - reset gate

        `h` - hidden gate

        `t` - time step (t-1 means previous time step)

        `W[zrh]` - W parameter weight matrix for update, reset, and hidden gates

        `R[zrh]` - R recurrence weight matrix for update, reset, and hidden gates

        `Wb[zrh]` - W bias vectors for update, reset, and hidden gates

        `Rb[zrh]` - R bias vectors for update, reset, and hidden gates

        `WB[zrh]` - W parameter weight matrix for backward update, reset, and hidden gates

        `RB[zrh]` - R recurrence weight matrix for backward update, reset, and hidden gates

        `WBb[zrh]` - W bias vectors for backward update, reset, and hidden gates

        `RBb[zrh]` - R bias vectors for backward update, reset, and hidden gates

        `H` - Hidden state

        `num_directions` - 2 if direction == bidirectional else 1

        Activation functions:

          Relu(x)                - max(0, x)

          Tanh(x)                - (1 - e^{-2x})/(1 + e^{-2x})

          Sigmoid(x)             - 1/(1 + e^{-x})

          (NOTE: Below are optional)

          Affine(x)              - alpha*x + beta

          LeakyRelu(x)           - x if x >= 0 else alpha * x

          ThresholdedRelu(x)     - x if x >= alpha else 0

          ScaledTanh(x)          - alpha*Tanh(beta*x)

          HardSigmoid(x)         - min(max(alpha*x + beta, 0), 1)

          Elu(x)                 - x if x >= 0 else alpha*(e^x - 1)

          Softsign(x)            - x/(1 + |x|)

          Softplus(x)            - log(1 + e^x)

        Equations (Default: f=Sigmoid, g=Tanh):

          - zt = f(Xt*(Wz^T) + Ht-1*(Rz^T) + Wbz + Rbz)

          - rt = f(Xt*(Wr^T) + Ht-1*(Rr^T) + Wbr + Rbr)

          - ht = g(Xt*(Wh^T) + (rt (.) Ht-1)*(Rh^T) + Rbh + Wbh) # default, when linear_before_reset = 0

          - ht = g(Xt*(Wh^T) + (rt (.) (Ht-1*(Rh^T) + Rbh)) + Wbh) # when linear_before_reset != 0

          - Ht = (1 - zt) (.) ht + zt (.) Ht-1
        This operator has **optional** inputs/outputs. See `ONNX <https://github.com/onnx/onnx/blob/master/docs/IR.md>`_ for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted.


        Args:
            X: The input sequences packed (and potentially padded) into one 3-D tensor
                with the shape of `[seq_length, batch_size, input_size]`.

            W: The weight tensor for the gates. Concatenation of `W[zrh]` and `WB[zrh]`
                (if bidirectional) along dimension 0. This tensor has shape
                `[num_directions, 3*hidden_size, input_size]`.

            R: The recurrence weight tensor. Concatenation of `R[zrh]` and `RB[zrh]` (if
                bidirectional) along dimension 0. This tensor has shape
                `[num_directions, 3*hidden_size, hidden_size]`.

            B: (optional) The bias tensor for the gates. Concatenation of `[Wb[zrh],
                Rb[zrh]]` and `[WBb[zrh], RBb[zrh]]` (if bidirectional) along dimension
                0. This tensor has shape `[num_directions, 6*hidden_size]`. Optional: If
                not specified - assumed to be 0

            sequence_lens: (optional) Optional tensor specifying lengths of the
                sequences in a batch. If not specified - assumed all sequences in the
                batch to have length `seq_length`. It has shape `[batch_size]`.

            initial_h: (optional) Optional initial value of the hidden. If not specified
                - assumed to be 0. It has shape `[num_directions, batch_size,
                hidden_size]`.

            activation_alpha: Optional scaling values used by some activation functions.
                The values are consumed in the order of activation functions, for
                example (f, g, h) in LSTM. Default values are the same as of
                corresponding ONNX operators.For example with LeakyRelu, the default
                alpha is 0.01.

            activation_beta: Optional scaling values used by some activation functions.
                The values are consumed in the order of activation functions, for
                example (f, g, h) in LSTM. Default values are the same as of
                corresponding ONNX operators.

            activations: A list of 2 (or 4 if bidirectional) activation functions for
                update, reset, and hidden gates. The activation functions must be one of
                the activation functions specified above. Optional: See the equations
                for default if not specified.

            clip: Cell clip threshold. Clipping bounds the elements of a tensor in the
                range of [-threshold, +threshold] and is applied to the input of
                activations. No clip if not specified.

            direction: Specify if the RNN is forward, reverse, or bidirectional. Must be
                one of forward (default), reverse, or bidirectional.

            hidden_size: Number of neurons in the hidden layer

            linear_before_reset: When computing the output of the hidden gate, apply the
                linear transformation before multiplying by the output of the reset
                gate.
        GRUr   r   rf   r(   )r+   rD   rn   ro   r1   rq   rs   rg   rh   ri   rj   rk   rl   rm   r,   r-   r!   r!   r"   ry     s    z
Opset7.GRUT_Gemmg      ?alphabetatransAtransBCr|   r}   r~   r   c          
      C  s8   t ddd}t| d|}	|	| ||||||||dS )u  [🌐 Gemm(7)](https://onnx.ai/onnx/operators/onnx__Gemm.html#gemm-7 "Online Documentation")

        General Matrix multiplication:
        https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3

        A' = transpose(A) if transA else A

        B' = transpose(B) if transB else B

        Compute Y = alpha * A' * B' + beta * C, where input tensor A has shape (M, K) or (K, M),
        input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N),
        and output tensor Y has shape (M, N). A will be transposed before doing the
        computation if attribute transA is non-zero, same for B and transB.
        This operator supports **unidirectional broadcasting** (tensor C should be unidirectional broadcastable to tensor A * B); for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.

        Args:
            A: Input tensor A. The shape of A should be (M, K) if transA is 0, or (K, M)
                if transA is non-zero.

            B: Input tensor B. The shape of B should be (K, N) if transB is 0, or (N, K)
                if transB is non-zero.

            C: Input tensor C. The shape of C should be unidirectional broadcastable to
                (M, N).

            alpha: Scalar multiplier for the product of input tensors A * B.

            beta: Scalar multiplier for input tensor C.

            transA: Whether A should be transposed

            transB: Whether B should be transposed
        Gemmr   r   r{   r(   )
r+   r0   r1   r   r|   r}   r~   r   r,   r-   r!   r!   r"   r   *  s   -zOpset7.Gemm	T_Greater
T1_Greaterc                 C  r2   )u|  [🌐 Greater(7)](https://onnx.ai/onnx/operators/onnx__Greater.html#greater-7 "Online Documentation")


        Returns the tensor resulted from performing the `greater` logical operation
        elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: First input operand for the logical operator.

            B: Second input operand for the logical operator.
        Greaterr   r   r(   r4   r!   r!   r"   r   e  r9   zOpset7.GreaterT_LSTMT1_LSTMrg   rh   ri   rj   rk   rl   input_forgetOptional[T_LSTM]Optional[T1_LSTM]	initial_cPr   Tuple[T_LSTM, T_LSTM, T_LSTM]c	                C  sH   t ddd}t| d|}|| |||||||||	|	|
|||||dS )u|  [🌐 LSTM(7)](https://onnx.ai/onnx/operators/onnx__LSTM.html#lstm-7 "Online Documentation")


        Computes an one-layer LSTM. This operator is usually supported via some
        custom implementation such as CuDNN.

        Notations:

        `X` - input tensor

        `i` - input gate

        `o` - output gate

        `f` - forget gate

        `c` - cell gate

        `t` - time step (t-1 means previous time step)

        `W[iofc]` - W parameter weight matrix for input, output, forget, and cell gates

        `R[iofc]` - R recurrence weight matrix for input, output, forget, and cell gates

        `Wb[iofc]` - W bias vectors for input, output, forget, and cell gates

        `Rb[iofc]` - R bias vectors for input, output, forget, and cell gates

        `P[iof]`  - P peephole weight vector for input, output, and forget gates

        `WB[iofc]` - W parameter weight matrix for backward input, output, forget, and cell gates

        `RB[iofc]` - R recurrence weight matrix for backward input, output, forget, and cell gates

        `WBb[iofc]` - W bias vectors for backward input, output, forget, and cell gates

        `RBb[iofc]` - R bias vectors for backward input, output, forget, and cell gates

        `PB[iof]`  - P peephole weight vector for backward input, output, and forget gates

        `H` - Hidden state

        `num_directions` - 2 if direction == bidirectional else 1

        Activation functions:

          Relu(x)                - max(0, x)

          Tanh(x)                - (1 - e^{-2x})/(1 + e^{-2x})

          Sigmoid(x)             - 1/(1 + e^{-x})

          (NOTE: Below are optional)

          Affine(x)              - alpha*x + beta

          LeakyRelu(x)           - x if x >= 0 else alpha * x

          ThresholdedRelu(x)     - x if x >= alpha else 0

          ScaledTanh(x)          - alpha*Tanh(beta*x)

          HardSigmoid(x)         - min(max(alpha*x + beta, 0), 1)

          Elu(x)                 - x if x >= 0 else alpha*(e^x - 1)

          Softsign(x)            - x/(1 + |x|)

          Softplus(x)            - log(1 + e^x)

        Equations (Default: f=Sigmoid, g=Tanh, h=Tanh):

          - it = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Pi (.) Ct-1 + Wbi + Rbi)

          - ft = f(Xt*(Wf^T) + Ht-1*(Rf^T) + Pf (.) Ct-1 + Wbf + Rbf)

          - ct = g(Xt*(Wc^T) + Ht-1*(Rc^T) + Wbc + Rbc)

          - Ct = ft (.) Ct-1 + it (.) ct

          - ot = f(Xt*(Wo^T) + Ht-1*(Ro^T) + Po (.) Ct + Wbo + Rbo)

          - Ht = ot (.) h(Ct)
        This operator has **optional** inputs/outputs. See `ONNX <https://github.com/onnx/onnx/blob/master/docs/IR.md>`_ for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted.


        Args:
            X: The input sequences packed (and potentially padded) into one 3-D tensor
                with the shape of `[seq_length, batch_size, input_size]`.

            W: The weight tensor for the gates. Concatenation of `W[iofc]` and
                `WB[iofc]` (if bidirectional) along dimension 0. The tensor has shape
                `[num_directions, 4*hidden_size, input_size]`.

            R: The recurrence weight tensor. Concatenation of `R[iofc]` and `RB[iofc]`
                (if bidirectional) along dimension 0. This tensor has shape
                `[num_directions, 4*hidden_size, hidden_size]`.

            B: (optional) The bias tensor for input gate. Concatenation of `[Wb[iofc],
                Rb[iofc]]`, and `[WBb[iofc], RBb[iofc]]` (if bidirectional) along
                dimension 0. This tensor has shape `[num_directions, 8*hidden_size]`.
                Optional: If not specified - assumed to be 0.

            sequence_lens: (optional) Optional tensor specifying lengths of the
                sequences in a batch. If not specified - assumed all sequences in the
                batch to have length `seq_length`. It has shape `[batch_size]`.

            initial_h: (optional) Optional initial value of the hidden. If not specified
                - assumed to be 0. It has shape `[num_directions, batch_size,
                hidden_size]`.

            initial_c: (optional) Optional initial value of the cell. If not specified -
                assumed to be 0. It has shape `[num_directions, batch_size,
                hidden_size]`.

            P: (optional) The weight tensor for peepholes. Concatenation of `P[iof]` and
                `PB[iof]` (if bidirectional) along dimension 0. It has shape
                `[num_directions, 3*hidde_size]`. Optional: If not specified - assumed
                to be 0.

            activation_alpha: Optional scaling values used by some activation functions.
                The values are consumed in the order of activation functions, for
                example (f, g, h) in LSTM. Default values are the same as of
                corresponding ONNX operators.For example with LeakyRelu, the default
                alpha is 0.01.

            activation_beta: Optional scaling values used by some activation functions.
                The values are consumed in the order of activation functions, for
                example (f, g, h) in LSTM. Default values are the same as of
                corresponding ONNX operators.

            activations: A list of 3 (or 6 if bidirectional) activation functions for
                input, output, forget, cell, and hidden. The activation functions must
                be one of the activation functions specified above. Optional: See the
                equations for default if not specified.

            clip: Cell clip threshold. Clipping bounds the elements of a tensor in the
                range of [-threshold, +threshold] and is applied to the input of
                activations. No clip if not specified.

            direction: Specify if the RNN is forward, reverse, or bidirectional. Must be
                one of forward (default), reverse, or bidirectional.

            hidden_size: Number of neurons in the hidden layer

            input_forget: Couple the input and forget gates if 1.
        LSTMr   r   r   r(   )r+   rD   rn   ro   r1   rq   rs   r   r   rg   rh   ri   rj   rk   rl   r   r,   r-   r!   r!   r"   r   }  s    (zOpset7.LSTMT_LessT1_Lessc                 C  r2   )up  [🌐 Less(7)](https://onnx.ai/onnx/operators/onnx__Less.html#less-7 "Online Documentation")


        Returns the tensor resulted from performing the `less` logical operation
        elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: First input operand for the logical operator.

            B: Second input operand for the logical operator.
        Lessr   r   r(   r4   r!   r!   r"   r   5  r9   zOpset7.LessT_Mulc                 C  r2   )u  [🌐 Mul(7)](https://onnx.ai/onnx/operators/onnx__Mul.html#mul-7 "Online Documentation")


        Performs element-wise binary multiplication (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: First operand.

            B: Second operand.
        Mulr   r   r(   r4   r!   r!   r"   r   K  r5   z
Opset7.MulT1_MultinomialT2_Multinomial   dtypesample_sizeseedr   r   r   c                C  s2   t ddd}t| d|}|| |||||dS )us  [🌐 Multinomial(7)](https://onnx.ai/onnx/operators/onnx__Multinomial.html#multinomial-7 "Online Documentation")


        Generate a tensor of samples from a multinomial distribution according to the probabilities
        of each of the possible outcomes.


        Args:
            input: Input tensor with shape [batch_size, class_size], where class_size is
                the number of all possible outcomes. Each value along the axis zero
                represents the unnormalized log-probability of each corresponding
                outcome in a batch.

            dtype: (Optional) The data type for the elements of the output tensor, if
                not specified, we will use int32.

            sample_size: Number of times to sample.

            seed: (Optional) Seed to the random generator, if not specified we will auto
                generate one.
        Multinomialr   r   r   r(   )r+   r$   r   r   r   r,   r-   r!   r!   r"   r   b  s   
zOpset7.MultinomialT_OrT1_Orc                 C  r2   )u  [🌐 Or(7)](https://onnx.ai/onnx/operators/onnx__Or.html#or-7 "Online Documentation")


        Returns the tensor resulted from performing the `or` logical operation
        elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: (non-differentiable) First input operand for the logical operator.

            B: (non-differentiable) Second input operand for the logical operator.
        Orr   r   r(   r4   r!   r!   r"   r     r9   z	Opset7.OrT_PReluslopec                 C  r2   )u*  [🌐 PRelu(7)](https://onnx.ai/onnx/operators/onnx__PRelu.html#prelu-7 "Online Documentation")


        PRelu takes input data (Tensor<T>) and slope tensor as input, and produces one
        output data (Tensor<T>) where the function `f(x) = slope * x for x < 0`,
        `f(x) = x for x >= 0`., is applied to the data tensor elementwise.
        This operator supports **unidirectional broadcasting** (tensor slope should be unidirectional broadcastable to input tensor X); for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.

        Args:
            X: Input tensor

            slope: Slope tensor. The shape of slope can be smaller than first input X;
                if so, its shape must be unidirectional broadcastable to X
        PRelur   r   r(   )r+   rD   r   r,   r-   r!   r!   r"   r     r9   zOpset7.PReluT_PowYc                 C  r2   )uu  [🌐 Pow(7)](https://onnx.ai/onnx/operators/onnx__Pow.html#pow-7 "Online Documentation")


        Pow takes input data (Tensor<T>) and exponent Tensor, and
        produces one output data (Tensor<T>) where the function `f(x) = x^exponent`,
        is applied to the data tensor elementwise.
        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.

        Args:
            X: First operand, base of the exponent.

            Y: Second operand, power of the exponent.
        Powr   r   r(   )r+   rD   r   r,   r-   r!   r!   r"   r     r5   z
Opset7.PowT_RNNT1_RNN)Tanhr   rg   rh   ri   rj   rk   rl   Optional[T_RNN]Optional[T1_RNN]Sequence[str]Tuple[T_RNN, T_RNN]c             
   C  sB   t ddd}t| d|}|| ||||||||||	|
||dS )u  [🌐 RNN(7)](https://onnx.ai/onnx/operators/onnx__RNN.html#rnn-7 "Online Documentation")


        Computes an one-layer simple RNN. This operator is usually supported
        via some custom implementation such as CuDNN.

        Notations:

        `X` - input tensor

        `i` - input gate

        `t` - time step (t-1 means previous time step)

        `Wi` - W parameter weight matrix for input gate

        `Ri` - R recurrence weight matrix for input gate

        `Wbi` - W parameter bias vector for input gate

        `Rbi` - R parameter bias vector for input gate

        `WBi` - W parameter weight matrix for backward input gate

        `RBi` - R recurrence weight matrix for backward input gate

        `WBbi` - WR bias vectors for backward input gate

        `RBbi` - RR bias vectors for backward input gate

        `H` - Hidden state

        `num_directions` - 2 if direction == bidirectional else 1

        Activation functions:

          Relu(x)                - max(0, x)

          Tanh(x)                - (1 - e^{-2x})/(1 + e^{-2x})

          Sigmoid(x)             - 1/(1 + e^{-x})

          (NOTE: Below are optional)

          Affine(x)              - alpha*x + beta

          LeakyRelu(x)           - x if x >= 0 else alpha * x

          ThresholdedRelu(x)     - x if x >= alpha else 0

          ScaledTanh(x)          - alpha*Tanh(beta*x)

          HardSigmoid(x)         - min(max(alpha*x + beta, 0), 1)

          Elu(x)                 - x if x >= 0 else alpha*(e^x - 1)

          Softsign(x)            - x/(1 + |x|)

          Softplus(x)            - log(1 + e^x)

        Equations (Default: f=Tanh):

          - Ht = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi)
        This operator has **optional** inputs/outputs. See `ONNX <https://github.com/onnx/onnx/blob/master/docs/IR.md>`_ for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted.


        Args:
            X: The input sequences packed (and potentially padded) into one 3-D tensor
                with the shape of `[seq_length, batch_size, input_size]`.

            W: The weight tensor for input gate. Concatenation of `Wi` and `WBi` (if
                bidirectional). The tensor has shape `[num_directions, hidden_size,
                input_size]`.

            R: The recurrence weight tensor. Concatenation of `Ri` and `RBi` (if
                bidirectional). The tensor has shape `[num_directions, hidden_size,
                hidden_size]`.

            B: (optional) The bias tensor for input gate. Concatenation of `[Wbi, Rbi]`
                and `[WBbi, RBbi]` (if bidirectional). The tensor has shape
                `[num_directions, 2*hidden_size]`. Optional: If not specified - assumed
                to be 0.

            sequence_lens: (optional) Optional tensor specifying lengths of the
                sequences in a batch. If not specified - assumed all sequences in the
                batch to have length `seq_length`. It has shape `[batch_size]`.

            initial_h: (optional) Optional initial value of the hidden. If not specified
                - assumed to be 0. It has shape `[num_directions, batch_size,
                hidden_size]`.

            activation_alpha: Optional scaling values used by some activation functions.
                The values are consumed in the order of activation functions, for
                example (f, g, h) in LSTM. Default values are the same as of
                corresponding ONNX operators.For example with LeakyRelu, the default
                alpha is 0.01.

            activation_beta: Optional scaling values used by some activation functions.
                The values are consumed in the order of activation functions, for
                example (f, g, h) in LSTM. Default values are the same as of
                corresponding ONNX operators.

            activations: One (or two if bidirectional) activation function for input
                gate. The activation function must be one of the activation functions
                specified above. Optional: Default `Tanh` if not specified.

            clip: Cell clip threshold. Clipping bounds the elements of a tensor in the
                range of [-threshold, +threshold] and is applied to the input of
                activations. No clip if not specified.

            direction: Specify if the RNN is forward, reverse, or bidirectional. Must be
                one of forward (default), reverse, or bidirectional.

            hidden_size: Number of neurons in the hidden layer
        RNNr   r   r   r(   )r+   rD   rn   ro   r1   rq   rs   rg   rh   ri   rj   rk   rl   r,   r-   r!   r!   r"   r     s    z
Opset7.RNNT_Sinc                 C  r&   )u   [🌐 Sin(7)](https://onnx.ai/onnx/operators/onnx__Sin.html#sin-7 "Online Documentation")


        Calculates the sine of the given input tensor, element-wise.


        Args:
            input: (differentiable) Input tensor
        Sinr   r   r(   r*   r!   r!   r"   r   b  r.   z
Opset7.SinT_Subc                 C  r2   )u  [🌐 Sub(7)](https://onnx.ai/onnx/operators/onnx__Sub.html#sub-7 "Online Documentation")


        Performs element-wise binary subtraction (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: First operand.

            B: Second operand.
        Subr   r   r(   r4   r!   r!   r"   r   s  r5   z
Opset7.SubT_Tanc                 C  r&   )u   [🌐 Tan(7)](https://onnx.ai/onnx/operators/onnx__Tan.html#tan-7 "Online Documentation")


        Calculates the tangent of the given input tensor, element-wise.


        Args:
            input: (differentiable) Input tensor
        Tanr   r   r(   r*   r!   r!   r"   r     r.   z
Opset7.Tan
T_Upsamplenearest)moder   scalesSequence[float]c                C  s0   t ddd}t| d|}|| ||||dS )u  [🌐 Upsample(7)](https://onnx.ai/onnx/operators/onnx__Upsample.html#upsample-7 "Online Documentation")


        Upsample the input tensor.
        Each dimension value of the output tensor is:
          output_dimension = floor(input_dimension * scale).


        Args:
            X: N-D tensor

            mode: Two interpolation modes: nearest (default), and linear (including
                bilinear, trilinear, etc)

            scales: The scale array along each dimension. It takes value greater than or
                equal to 1. The number of elements of 'scales' should be the same as the
                rank of input 'X'.
        Upsampler   r   )r   r   r(   )r+   rD   r   r   r,   r-   r!   r!   r"   r     s   zOpset7.UpsampleT_XorT1_Xorc                 C  r2   )u  [🌐 Xor(7)](https://onnx.ai/onnx/operators/onnx__Xor.html#xor-7 "Online Documentation")


        Returns the tensor resulted from performing the `xor` logical operation
        elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support).

        This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check `Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>`_.


        Args:
            A: (non-differentiable) First input operand for the logical operator.

            B: (non-differentiable) Second input operand for the logical operator.
        Xorr   r   r(   r4   r!   r!   r"   r     r9   z
Opset7.Xor)r$   r#   r%   r#   )r0   r/   r1   r/   r%   r/   )r0   r6   r1   r6   r%   r7   )r$   r:   r%   r:   )r$   r<   r%   r<   )rD   r>   r@   rE   rA   rF   rG   rH   rB   rI   rC   rI   r%   r>   )rD   rK   rQ   rK   r1   rK   rR   rK   rS   rK   rN   rT   rO   rT   rP   rF   r%   rU   )r$   rW   r%   rW   )r0   rY   r1   rY   r%   rY   )r]   r[   r\   rT   r%   r^   )r0   r`   r1   r`   r%   ra   )NNN)rD   rc   rn   rc   ro   rc   r1   rp   rq   rr   rs   rp   rg   rt   rh   rt   ri   ru   rj   rv   rk   rE   rl   rw   rm   rF   r%   rx   )r0   rz   r1   rz   r   rz   r|   rT   r}   rT   r~   rF   r   rF   r%   rz   )r0   r   r1   r   r%   r   )NNNNN) rD   r   rn   r   ro   r   r1   r   rq   r   rs   r   r   r   r   r   rg   rt   rh   rt   ri   ru   rj   rv   rk   rE   rl   rw   r   rF   r%   r   )r0   r   r1   r   r%   r   )r0   r   r1   r   r%   r   )
r$   r   r   rF   r   rF   r   rv   r%   r   )r0   r   r1   r   r%   r   )rD   r   r   r   r%   r   )rD   r   r   r   r%   r   )rD   r   rn   r   ro   r   r1   r   rq   r   rs   r   rg   rt   rh   rt   ri   r   rj   rv   rk   rE   rl   rw   r%   r   )r$   r   r%   r   )r0   r   r1   r   r%   r   )r$   r   r%   r   )rD   r   r   rE   r   r   r%   r   )r0   r   r1   r   r%   r   )V__name__
__module____qualname__r   r   r   r   r   r#   r'   r   r   r   r   r/   r3   r   r6   __annotations__r7   r8   r:   r;   r<   r=   r>   rJ   rK   rV   rW   rX   rY   rZ   r[   r_   r`   ra   rb   rc   rd   ry   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r!   r!   r"   r   )   s  
 




R
H


	 $7
 5

'


	 


r   N)"
__future__r   typingr   r   r   r   r   	onnx.defsr   typing_extensionsr	   "onnxscript.onnx_opset._impl.opset6r
   onnxscript.onnx_typesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   onnxscript.valuesr   r   r   r!   r!   r!   r"   <module>   s   D