Help Center/ Atlas 500 Application/ TE API Reference/ Compute APIs/ te.lang.cce.vmaddrelu(x, y, z)
Updated on 2022-03-13 GMT+08:00

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

Multiplies each element in x by a corresponding element in z, adds a corresponding element in y, and then performs the ReLU operation. 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: relu(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.vmaddrelu(data1, data2, data3)