nvidia.dali.experimental.dynamic.arithmetic_generic_op#

nvidia.dali.experimental.dynamic.arithmetic_generic_op(input_0, /, *inputs, batch_size=None, device=None, expression_desc, integer_constants=None, real_constants=None)#

Arithmetic operator capable of executing expression tree of element-wise arithmetic operations.

Supported backends
  • ‘cpu’

  • ‘gpu’

Parameters:
  • input_0 (Tensor/Batch) – Input to the operator.

  • inputs[1..63] (Tensor/Batch, optional) – This function accepts up to 63 optional positional inputs

Keyword Arguments:
  • expression_desc (str) –

    Polish notation describing the expression extendend with parentheses, see https://en.wikipedia.org/wiki/Polish_notation. Functions and operations are indicated by names, followed by parentheses. Inputs (subexpressions) are placed in the parentheses and are separated by spaces, &<uint> indicates tensor input, $<uint>:<type_string> indicates constant.

    More formally using BNF grammar:

    <expr>    ::= <call> | <scalar> | <input>
    <subexpr> ::= <expr> | <expr> " " <subexpr>
    <call>    ::= <name> "(" <subexpr> ")"
    <name>    ::= identifier starting with alphabetic character
    <input>   ::= "&" <uint>
    <scalar>  ::= "$" <uint> ":" <type>
    <uint>    ::= unsigned integer
    <type>    ::= uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64
                        | float16 | float32 | float64
    

    Examples:

    add(&0 mul(&1 $0:int8))
    add(&0 rand())
    

  • integer_constants (int or list of int or Tensor/Batch of int, optional) –

  • real_constants (float or list of float or Tensor/Batch of float, optional) –