- Description:
- When fake_quant_enabled is greater than or equal to 1: Performs fake quantization on the input self with scale and zero_point, limits the value range of the fake-quantized output by quant_min and quant_max, and finally returns the output out as well as the corresponding position mask mask.
- When fake_quant_enabled is less than 1: Returns out as a clone of self, and mask with all values set to True.
- Formula: When fake_quant_enabled is greater than or equal to 1, computes the temporary variable qval, then calculates out and mask.
Each operator has calls. First, aclnnFakeQuantPerTensorAffineCachemaskGetWorkspaceSize is called to obtain the input parameters and compute the required workspace size based on the process. Then, aclnnFakeQuantPerTensorAffineCachemask is called to perform computation.
[object Object][object Object]
Parameters
- self (aclTensor*, input): input tensor, corresponding to
[object Object]in the formula. This tensor is a device-side aclTensor. The data type can be FLOAT16 or FLOAT32. are supported. The can be ND. - scale (aclTensor*, input): scaling coefficient for input fake quantization, corresponding to
[object Object]in the formula. This tensor is a device-side aclTensor. The data type can be FLOAT16 or FLOAT32, and the shape must be one-dimensional with a size of 1. - zeroPoint (aclTensor*, input): zero-point parameter for input fake quantization, corresponding to
[object Object]in the formula. This tensor is a device-side aclTensor. The data type must be INT32, and the shape must be one-dimensional with a size of 1. - fakeQuantEnabled (float, input): host-side floating-point value that indicates whether to perform fake quantization.
- quantMin (int64_t, input): host-side integer that represents the minimum value after fake quantization of the input data. It must be less than or equal to quantMax.
- quantMax (int64_t, input): host-side integer that represents the maximum value after fake quantization of the input data. It must be greater than or equal to quantMin.
- out (aclTensor*, output): output tensor. This tensor is a device-side aclTensor. The data type can be FLOAT16 or FLOAT32, and the shape must be the same as that of
[object Object]. are supported. The can be ND. - mask (aclTensor*, output): mask tensor. This tensor is a device-side aclTensor. The data type must be BOOL, and the shape must be the same as that of
[object Object]. are supported. The can be ND. - workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
- executor (aclOpExecutor**, output): operator executor, containing the operator computation flow.
- self (aclTensor*, input): input tensor, corresponding to
Returns
[object Object]
Parameters
- workspace (void*, input): address of the workspace to be allocated on the device.
- workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained via the first-phase API aclnnFakeQuantPerTensorAffineCachemaskGetWorkspaceSize.
- executor (aclOpExecutor*, input): operator executor, containing the operator computation flow.
- stream (aclrtStream, input): stream for executing the task.
Returns
- Deterministic computation:
- aclnnFakeQuantPerTensorAffineCachemask defaults to a deterministic implementation.
The following example is for reference only. For details, see .
[object Object]