mmad
Function
Performs matrix multiplication and addition.
Prototype
1 | class mmad(x, y, b, is_inited=False) |
Parameters
Parameter |
Data Type |
Description |
|---|---|---|
x |
Tensor variable |
Left matrix, in the L0A space. FP16 is supported. |
y |
Tensor variable |
Right matrix, in the L0B space. FP16 is supported. |
b |
Tensor variable |
Bias term, which can be in the L0C space or Bias Table space. FP32 is supported |
is_inited |
bool |
When the input is in the L0C space, is_inited=True needs to be added because there is no direct channel to transfer data from the GM to the L0C. |
Constraints
When the bias term is in the Bias Table space, the tensor data format must be ND and shape must be [n,].
Example
1 2 3 4 5 | from mskpp import mmad, Tensor in_x = Tensor("GM", "FP16", [32, 48], format="ND") in_y = Tensor("GM", "FP16", [48, 16], format="ND") in_z = Tensor("GM", "FP32", [32, 16], format="NC1HWC0") out_z = mmad(in_x, in_y, in_z)() |
Parent topic: Description of msKPP External APIs