vmuls

Description

Multiplies raw_tensor by a scalar element-wise.

Prototype

vmuls(raw_tensor, scalar)

Parameters

  • raw_tensor: a tvm.tensor for the input tensor
  • scalar: a scalar for the coefficient by which a raw_tensor is multiplied element-wise
  • If the data type of raw_tensor is complex32, the data type of scalar must be float16. If the data type of raw_tensor is complex64, the data type of scalar must be float32. If the data type of raw_tensor is not complex32 or complex64, the data type of scalar must be the same as that of raw_tensor. If they are different, the data type of scalar will be converted to the data type of raw_tensor.

    Atlas training product: supports float16, float32, int32, and int64.

    Atlas inference product: supports float16, int16, float32, int32, and int64.

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

    Atlas A2 training product/Atlas A2 inference product: supports float16, float32, int32, int64, complex32, and complex64.

    Atlas A3 training product/Atlas A3 inference product: supports float16, float32, int32, int64, complex32, and complex64.

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"
data = tvm.placeholder(shape, name="data", dtype=input_dtype)
scalar = tvm.const(2, dtype =input_dtype)
res = dsl.vmuls(data, scalar)