vmadd

Description

Multiplies tensor_0 by tensor_2 and adds tensor_1 to the result element-wise. The corresponding computation formula is tensor_0 x tensor_2 + tensor_1

Prototype

vmadd(tensor_0, tensor_1, tensor_2)

Parameters

  • tensor_0: a tvm.tensor for tensor 0
  • tensor_1: a tvm.tensor for tensor 1
  • tensor_2: a tvm.tensor for tensor 2
  • The tensors must have the same data type and shape.

    Atlas training product: supports float16 and float32.

    Atlas inference product: supports float16 and float32.

    Atlas 200I/500 A2 inference product: supports float16 and float32.

    Atlas A2 training product/Atlas A2 inference product: supports float16 and float32.

    Atlas A3 training product/Atlas A3 inference product: supports float16 and float32.

Returns

res_tensor: a tvm.tensor for the result tensor

Restrictions

None

Applicability

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas A3 training product/Atlas A3 inference product

Example

from tbe import tvm
from tbe import dsl
shape = (1024,1024)
input_dtype = "float16"
data1 = tvm.placeholder(shape, name="data1", dtype=input_dtype)
data2 = tvm.placeholder(shape, name="data2", dtype=input_dtype)
data3 = tvm.placeholder(shape, name="data3", dtype=input_dtype)
res = dsl.vmadd(data1, data2, data3)