API List
|
Function |
API |
Description |
|---|---|---|
|
TIK container management |
Creates a TIK DSL container. |
|
|
Generates a TIK description language defined on the target machine and builds the TIK description language into a binary that is executable on Ascend AI Processor and the corresponding configuration file. |
||
|
Data definition |
Defines a Tensor variable. |
|
|
Defines a Scalar variable. |
||
|
Defines a scalar variable as the InputScalar type for operator implementation. In this case, the inputs argument of type InputScalar passed to the BuildCCE call is the value obtained at operator run time. |
||
|
Scalar management |
Sets the value of a Scalar. |
|
|
Tensor management |
Reshapes a Tensor. |
|
|
Reinterprets a Tensor into a specified data type. |
||
|
Obtains partial data of a Tensor by the index. |
||
|
Sets the content of a Tensor by index. |
||
|
Obtains the shape of a Tensor. |
||
|
Sets a Tensor. |
||
|
Program control |
Specifies the if_scope code block to be executed if a specified condition of TIK is true. |
|
|
Specifies the current elif_scope code block to be executed if previous if_scope and elif_scope are not true and the current elif_scope is true. |
||
|
Specifies the code block in the else_scope statement to be executed if previous if_scope and elif_scope statements are not true. |
||
|
Indicates the for loop statement of the TIK. N buffers and multiple blocks can be enabled in the for loop. |
||
|
Indicates a new scope (equivalent to the curly brackets in C language). The disable_sync parameter specifies whether to automatically insert a synchronization instruction in the current scope. |
||
|
Returns False if all arguments are false; True if one of the arguments is true. |
||
|
Returns True if all arguments are true; False if one of the arguments is false. |
||
|
Returns True if the argument is false; False otherwise. |
||
|
Skips the current loop to enter the next one. Used in TIK's for_range loop. |
||
|
Terminates the for_range loop statement, that is, stopping executing the current loop. |
||
|
Returns at the instruction or layer position as required, which is often used to set a breakpoint. |
||
|
Function debugging |
TIK performs debugging in the simulation environment using the tik.tikdb object. Similar to the Python Debugger (PDB), the tikdb supports setting breakpoints, single-step debugging, and printing variables. |
|
|
The tik.tikdb object defines the debug_print statement to facilitate data printing at operator run time. When the debugger executes this line of code, it evaluates the expression and prints the result on the screen. |
||
|
Sets printf parameters. |
||
|
Prints the value of a Scalar, an Expr, a ScalarArray, or a Tensor. This API is supported even in the functional debugging environment. |
||
|
Scalar computation (single-operand) |
Obtains the absolute value of a Scalar: |
|
|
Extracts the square root of a Scalar: |
||
|
Counts the number of bits whose values are 0 in the 64-bit binary format of the source operand bitwise. |
||
|
Counts the number of bits whose values are 1 in the 64-bit binary format of the source operand bitwise. |
||
|
Counts the number of consecutive bits whose values are 0 in the 64-bit binary format of the source operand. |
||
|
Converts the data type of a Scalar. |
||
|
Scalar computation (dual-operand) |
Compares two source operands and returns the maximum: |
|
|
Compares two source operands and returns the minimum: |
||
|
Vector computation (single-operand) |
Performs ReLU element-wise: |
|
|
Computes the absolute value element-wise: |
||
|
Performs bitwise NOT element-wise: |
||
|
Computes the natural exponential element-wise: |
||
|
Computes the natural base element-wise: |
||
|
Computes the natural logarithm element-wise: |
||
|
Computes the natural logarithm element-wise: |
||
|
Computes the reciprocal element-wise: |
||
|
Computes the reciprocal element-wise: |
||
|
Computes the reciprocal after extracting the square root element-wise: |
||
|
Computes the reciprocal after extracting the square root element-wise: |
||
|
Vector computation (dual-operand) |
Performs addition element-wise: |
|
|
Performs subtraction element-wise: |
||
|
Performs multiplication element-wise: |
||
|
Computes the maximum element-wise: |
||
|
Computes the minimum element-wise: |
||
|
Performs bitwise AND element-wise: |
||
|
Performs bitwise OR element-wise: |
||
|
Vector computation > Scalar dual-operand |
Performs addition between a vector and a scalar element-wise: |
|
|
Performs multiplication between a vector and a scalar element-wise: |
||
|
Vector computation > Scalar triple-operand |
Performs multiplication-accumulation between a vector and a scalar element-wise. |
|
|
Vector computation >Comparison selection |
Compares two tensors by returning the truth value element-wise to the corresponding bits of dst. Multiple comparison modes are supported. |
|
|
Selects elements based on sel bitwise. If a bit is 1, the corresponding element in src0 is selected; if a bit is 0, src1. The selections are recorded as dst_temp and then filtered by mask. The left bits are set to the result dst, and the filtered bits retain dst's original value. |
||
|
Vector computation > Data precision conversion |
Converts the src tensor with one data type to the dst tensor with a different data type. |
|
|
Vector computation > Pair reduction |
Adds elements (odd and even) between adjacent pairs: |
|
|
Vector computation > Reduction |
Adds all input data. Each two data pieces are added in binary tree mode. |
|
|
Obtains the maximum value and its corresponding index position among the input data. |
||
|
Obtains the minimum value and its corresponding index position among the input data. |
||
|
Matrix computation |
Performs 2D convolution on an input tensor and a weight tensor and outputs a result tensor. |
|
|
Processes the matrix compute result, for example, adding an offset to and quantizing the compute result, and moving the data from the L1OUT Buffer to the Global Memory. |
||
|
Multiplies tensor a by tensor b and outputs a result tensor. |
||
|
Data conversion |
Transposes contiguous blocks of a 16 x 16 2D matrix for repeat_times times. Each iteration operates 256 contiguous address space data blocks. The addresses between different iterations can be incontiguous. The address space between adjacent iterations is specified by dst_rep_stride and src_rep_stride. |
|
|
Converts NCHW into NC1HWC0. If the data type is float32, int32, uint32, int16, unint16, or float16, then C0 is 16. If the data type is uint8 or int8, then C0 is 32. |
||
|
Data padding |
Copies a Scalar variable or an immediate for multiple times and fill it in the vector (PAR indicates the degree of parallelism): |
|
|
Data movement |
Moves data between src and dst. Both src and dst can be Tensors at the same time. |

























