vadd

Function

vadd instruction abstraction.

z = x + y, where x and y are added by element.

Prototype

1
class vadd(x, y, z)

Parameters

Parameter

Input/Output

Data Type

Description

x

Input

Tensor variable

Input x-vector tensor. FP16, FP32, INT16, and INT32 are supported.

y

Input

Tensor variable

Input y-vector tensor. FP16, FP32, INT16, and INT32 are supported.

z

Output

Tensor variable

Output vector tensor.

Constraints

The tensors of all input and output data of vector instructions are in the UB space, and their shapes must be the same.

Example

1
2
3
4
5
6
from mskpp import vadd, Tensor
ub_x, ub_y, ub_z = Tensor("UB"), Tensor("UB"), Tensor("UB")
gm_x, gm_y = Tensor("GM"), Tensor("GM")
ub_x.load(gm_x)
ub_y.load(gm_y)
out = vadd(ub_x, ub_y, ub_z)()