SetOrgShape
Function Usage
Sets the original complete shape in the M, N, and K directions during Matmul computation. The unit is the number of elements. It is used to modify the shape during running. For example, reuse the same Matmul object and obtain data from different matrix blocks for computation.
Prototype
1 | __aicore__ inline void SetOrgShape(int orgM, int orgN, int orgK) |
1 | __aicore__ inline void SetOrgShape(int orgM, int orgN, int orgKa, int orgKb, int orgKc = 0) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
orgM |
Input |
|
orgN |
Input |
|
orgK |
Input |
|
orgKa |
Input |
|
orgKb |
Input |
|
orgKc |
Input |
N of the output matrix C. Unit: element. This parameter can be set when N of the input matrix B is different from that of the output matrix C. The default value is 0, indicating that N of matrix B is used. |
Returns
None
Availability
Precautions
This API must be called before SetTensorA, SetTensorB, and SetSingleShape.
Example
1 2 3 4 5 6 7 8 9 10 11 | REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling); mm.SetTensorA(gm_a); mm.SetTensorB(gm_b); mm.SetBias(gm_bias); mm.IterateAll(gm_c); // Reuse the mm object. mm.SetOrgShape(orgM, orgN, orgK); mm.SetTensorA(gm_a1); mm.SetTensorB(gm_b1); mm.SetBias(gm_bias1); mm.IterateAll(gm_c1); |
Parent topic: Matmul