As explained in the introduction, the lowest level of the libraries is a set of APIs, which are created to create a closest mapping possible between NumPy and the C++ SIMD APIs of the AI Engine. The APIs resulted are a more comprehensive and easy interface for you to create your application using numpy-like interfaces. The APIs can be divided in two main groups:
- Element-wise operations between vectors and matrices. Those operations vary between basic operations (that is, sum, multiplication, and so on) to more complex ones (that is, reciprocal, sign, and so on);
- Vector managing and creation. Those operations are intended to be used by you to create or modify the dimension of the vectorial operands. Two example of those operations are Tile and Ones.
The APIs are written in a templatic way, such that you might parametrize the length of the operands or of the SIMD operations to suit the necessities of the customers. Before starting with the single kernels explanation is the nomenclature used in the kernels. The kernels are thought to be used as you would do in NumPy, but on the contrary, with respect to what is possible in python, in C++, the dimensionality of the operands must be known a priori to write appropriate and correct operations. For common DSP and BLAS applications, such as Ultrasound Imaging, it is important to control the dimensionality of the data to build appropriate applications. This is why the kernels have been written in the following way:
The first part of the name indicates the type of operation chosen. The second and the third parts of the names of the interface are optional, depending on the number of operands of the operation. Provided that they are two, the letter S/V/M indicates their dimensionality. S stands for Scalar, V for Vector, and M for Matrix. For example, mulMV is the operation, which multiplies (element-wise) the rows of a Matrix (as first operand, M) with a Vector of the same dimension (as second operand, V). Another example is diffSV, an operation that subtracts a scalar value (as first operand, S) to every element of a Vector (as second operand, V).
The details of the L1 kernel available in the library is as follows: