vconv

Function

vconv instruction abstraction.

y = vconv(x, dtype), where vconv indicates the vector calculation for type cast of input data.

Currently, the following cast types are supported: BF16->FP32, FP16->FP32, FP16->INT16, FP16->INT32, FP16->INT4, FP16->INT8, FP16->UINT8, FP32->BF16, FP32->FP16, FP32->INT32, FP32->INT64 and INT4->FP16, INT64->FP32, INT8->FP16, and UINT8->FP16.

Prototype

1
class vconv(x, y, dtype)

Parameters

Parameter

Input/Output

Data Type

Description

x

Input

Tensor variable

Input x-vector tensor.

y

Output

Tensor variable

Output y-vector tensor.

dtype

Input

String

Data type of the target tensor.

Example

1
2
3
4
5
from mskpp import vconv, Tensor
ub_x, ub_y = Tensor("UB", "FP16"), Tensor("UB")
gm_x = Tensor("GM")
ub_x.load(gm_x)
out = vconv(ub_x, ub_y, "FP32")()