[][src]Function onednn_sys::dnnl_post_ops_append_sum

pub unsafe extern "C" fn dnnl_post_ops_append_sum(
    post_ops: dnnl_post_ops_t,
    scale: f32
) -> dnnl_status_t

Appends an accumulation (sum) to post-ops. Prior to accumulating the result, the previous value is multiplied by a scale.

The kind of this post-op is #dnnl_sum.

This feature may improve performance for cases like residual learning blocks, where the result of convolution is accumulated to the previously computed activations. The parameter @p scale may be used for the integer-based computations when the result and previous activations have different logical scaling factors.

In the simplest case when the accumulation is the only post-op, the computations would be:

dst[:] <- scale * dst[:] + op(...) // instead of dst[:] <- op(...)

@note This post-op executes in-place and does not change the destination layout.

@param post_ops Post-ops. @param scale Accumulation scaling factor. @returns #dnnl_success on success and a status describing the error otherwise.