Updated on 2022-03-13 GMT+08:00

te.lang.cce.vmadd(x, y, z)

Multiplies each element in x by a corresponding element in z, and then adds a corresponding element in y. The data types of the three tensors must be the same. The supported types are float16 and float32. The data types int8, uint8, and int32 are converted to float16.

This API is defined in elewise_compute.py.

Parameter Description

  • x: tensor, tvm.tensor type
  • y: tensor, tvm.tensor type
  • z: tensor, tvm.tensor type

Return Value

res_tensor: x * z + y, tvm.tensor type

Calling Example

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 = te.lang.cce.vmadd(data1, data2, data3)