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

te.lang.cce.vmuls(raw_tensor, scalar)

Multiplies each element in raw_tensor by a scalar. The supported types are float16 and float32. The data types int8, uint8, and int32 are converted to float16. If the data type of a scalar is different from that of raw_tensor, the data type is converted into the corresponding data type.

This API is defined in elewise_compute.py.

Parameter Description

  • raw_tensor: input tensor, tvm.tensor type
  • scalar: coefficient by which the element in raw_tensor is multiplied, scalar type

Return Value

res_tensor: raw_tensor x scalar, tvm.tensor type

Calling Example

shape = (1024,1024)
input_dtype = "float16"
data = tvm.placeholder(shape, name="data", dtype=input_dtype)
scalar = tvm.const(2, dtype =input_dtype)
res = te.lang.cce.vmuls(data, scalar)