[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Performs fake quantization on the input self along the specified axis 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.
  • Formula: Computes the temporary variable qval, then calculates out and mask.qval=Round(std::nearby_int(self/scale)+zero_point)qval = Round(std::nearby\_int(self / scale) + zero\_point) out=(Min(quant_max,Max(quant_min,qval))zero_point)scaleout = (Min(quant\_max, Max(quant\_min, qval)) - zero\_point) * scale mask=(qval>=quant_min)&(qval<=quant_max)mask = (qval >= quant\_min) \& (qval <= quant\_max)
[object Object]

Each operator has calls. First, aclnnFakeQuantPerChannelAffineCachemaskGetWorkspaceSize is called to obtain the input parameters and compute the required workspace size based on the process. Then, aclnnFakeQuantPerChannelAffineCachemask is called to perform computation.

  • [object Object]
  • [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. It supports . Its 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. The size must be consistent with that of zeroPoint and with the size of self along the axis dimension. It supports . Its can be ND.
    • 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 can be INT32, and the shape must be one-dimensional. The size must be consistent with that of scale and with the size of self along the axis dimension. It supports . Its can be ND.
    • axis (int64_t, input): host-side integer that specifies the computation dimension. The value range is [–self.dim(), self.dim() – 1].
    • 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, 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 the same as that of [object Object]. It supports . Its can be ND.
    • mask (aclTensor*, output): mask tensor, corresponding to [object Object] in the formula. 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]. It supports . Its 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.
  • Returns

    aclnnStatus: status code. For details, see .

[object Object]
[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 aclnnFakeQuantPerChannelAffineCachemaskGetWorkspaceSize.
    • executor (aclOpExecutor*, input): operator executor, containing the operator computation flow.
    • stream (aclrtStream, input): stream for executing the task.
  • Returns

    aclnnStatus: status code. For details, see .

[object Object]
  • Deterministic computation:

    • aclnnFakeQuantPerChannelAffineCachemask defaults to a deterministic implementation.
  • The current operator FakeQuantPerChannelAffineCachemask does not yet support FLOAT32 or FLOAT16 inputs for zero_point. This constraint is currently enforced at the aclnn API level and will be lifted once the operator natively supports these data types.

[object Object]

The following example is for reference only. For details, see .

[object Object]