- Description: During l@r matrix multiplication, you can use the msModelSlim tool to losslessly compress the r matrix to reduce the memory usage of the r matrix, and then use this API to complete lossless decompression, matrix multiplication, and dequantization.
- Formula:
[object Object] indicates the one-dimensional data of the r matrix after being compressed by the msModelSlim tool. [object Object] and [object Object] indicate the information related to the compression algorithm. [object Object] is the data after lossless decompression in this API (consistent with the original r matrix data). For details about the compression and calling example of this API, see .
Each operator has calls. First, [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, [object Object] is called to perform computation.
Parameters:
[object Object]Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
- Deterministic computation
[object Object]defaults to deterministic implementation.
- Prepare the data before compression.
Assume that the input data is generated using the
[object Object]script. The following is an example for reference only:
Execute gen_data.py. Assume that the input shapes of mat1 and mat2 are m=512, k=1024, and n=1024.
- Preprocess data.
Use the msModelSlim tool to compress the original weight to generate the compressed x2, compressIndex, and compressInfo.
When using the following APIs, you need to compile the msModelSlim tool in the CANN package. For details, see [object Object] in the [object Object] directory in the .
Convert the dequantization parameter deqscale of the original float type to obtain the uint64 data required by the aclnn API.
The original deqScale is of the float type. It is read as int32 and converted to int64.
- Call the aclnn API for computation.
The following example is for reference only. For details, see .