UH-OH

It looks like you don’t have access to that feature yet

Contact sales to get upgraded to the full DevStudio experience.

UH-OH

It looks like you don't have access to that feature yet.

to select
to navigate
escto close
Chimera Compute Library (CCL) API ReferenceNeural Network BlocksActivation Functions

Activation Functions

Sigmoids

File: /src/neuralNetBlocks/activations.hppLines 31–45
    /**
     * @brief This calculates the following sigmoid function for all elements in a single tile. 
     * 
     * `f(x) = 1/(1 + exp(-x))`
     *
     * @ingroup activations
     * @param      x            A single tile of data.
     *
     * @tparam     numFracBits  Number of fraction bits in the fixedpoint numbers.
     * @tparam     T            The type of the data.
     * @return     result       The sigmoid function outputs for all elements in a tile.
     */
    // clang-format on
    template <FracRepType numFracBits, typename T>
    INLINE qVar_t<FixedPoint<T, 31>> sigmoid(qVar_t<FixedPoint<T, numFracBits>> x) {

TanH (Hyperbolic Tangents)

File: /src/neuralNetBlocks/activations.hppLines 104–118
    /**
     * @brief This function performs the tanh function on the input, which is a single tile.
     * 
     * `tanh(x) = (1- exp(-2*x))/(1 + exp(-2*x))`
     *
     * @ingroup activations
     * @param      x            A single tile of data.
     *
     * @tparam     numFracBits  Number of fraction bits in the fixedpoint numbers.
     * @tparam     T            The type of the data.
     * @return     result       The tanh function outputs for all elements in a tile.
     */
    // clang-format on
    template <FracRepType numFracBits, typename T>
    INLINE qVar_t<FixedPoint32<31>> tanh(qVar_t<FixedPoint<T, numFracBits>> x) {

ReLU (Rectified Linear Units)

File: /src/neuralNetBlocks/activations.hppLines 204–217
    /**
     * @brief This function performs the ReLU6 function on the input, which is a single tile: `f(x) = min(max(0, x), 6)`.
     *
     * @param      qData     A single tile of data
     *
     * @tparam    reluMethod  The Relu method chosen.
     * @tparam    T           The type of the data
     * @return    qOutout     The ReLU6 function outputs for all elements in a tile.
     */
    // clang-format on
    template <ReluMethod reluMethod,
              typename T,
              typename std::enable_if_t<reluMethod == ReluMethod::SIX, std::int32_t> = 0>
    INLINE qVar_t<T> relu(qVar_t<T> qData) {
File: /src/neuralNetBlocks/activations.hppLines 204–217
    /**
     * @brief This function performs the ReLU6 function on the input, which is a single tile: `f(x) = min(max(0, x), 6)`.
     *
     * @param      qData     A single tile of data
     *
     * @tparam    reluMethod  The Relu method chosen.
     * @tparam    T           The type of the data
     * @return    qOutout     The ReLU6 function outputs for all elements in a tile.
     */
    // clang-format on
    template <ReluMethod reluMethod,
              typename T,
              typename std::enable_if_t<reluMethod == ReluMethod::SIX, std::int32_t> = 0>
    INLINE qVar_t<T> relu(qVar_t<T> qData) {

Softmax

File: /src/neuralNetBlocks/activations.hppLines 427–471
    /**
     * @brief This function performs a softmax, or normalized exponential function, on the input data buffer
     * and stores the result in the output data buffer.
     *
     * A softmax normalizes the input data to a probability distribution proportional to the exponentials of
     * the inputs. In other words, softmax takes the exponential function of each input elements and then
     * normalizes by dividing each of the elements by the sum of all the exponentials. The output has the same
     * shape as the input but is bound to the interval (0, 1).
     *
     * Additionally, there is a iteration that goes through the
     * the scores and takes the maximum value for each channel. This maximum is subtracted
     * from each score with a new range of (-inf, 0] so the output of exp
     * is bound to the interval (0, 1]. This is done to ensure that the
     * softmax has a countable sum (0, Height*Width) which is numerically stable while
     * still ensuring that the maximum/largest scores are well represented in fixed-point.
     *
     * The equation for softmax is:
     *
     * ```
     *   softmax(x_i) = exp(x_i) / summation(exp(x_j) for all j)
     * ```
     *
     * @tparam OcmTensorShape The shape of the OCM that we get values from.
     * @tparam masked Whether or not to apply a causal mask to this softmax.
     * @tparam NDArrayIn The input NDArray type.
     * @tparam NDArrayOut The output NDArray type.
     * @tparam Lambda The type of the lambda postprocessing function.
     * @tparam channelwiseSoftmax If Softmax performs channelwise reduction or not.
     * @param qInBuffer The input buffer.
     * @param qOutBuffer The output buffer.
     * @param maskThresh The mask threshold to be apply if masked=true.
     * @param postProc The postprocessing function.
     * @return INLINE
     */
    template <typename OcmTensorShape,
              bool masked = false,
              typename NDArrayIn,
              typename NDArrayOut,
              typename Lambda                                    = EmptyType,
              bool channelwiseSoftmax                            = (OcmTensorShape::NUM_CHN == 1),
              std::enable_if_t<channelwiseSoftmax, std::int32_t> = 0>
    INLINE void softmax(NDArrayIn&          qInBuffer,
                        NDArrayOut&         qOutBuffer,
                        const std::int32_t& maskThresh = OcmTensorShape::NUM_ELEMS_PER_BCH,
                        const Lambda&       postProc   = EmptyType()) {

Mish

File: /src/neuralNetBlocks/activations.hppLines 235–245
    /**
     * @brief This function calculates mish activation: `f(x) = x * tanh(log(exp(x)+1))`.
     *
     * @param      x     A single tile of data
     *
     * @tparam     T         The type of the data
     * @return     result    Mish activation function outputs.
     */
    // clang-format on
    template <typename T>
    INLINE qVar_t<T> mish(qVar_t<T> x) {
Table of Contents


© Copyright 2026 Quadric All Rights Reserved • Privacy Policy
This documentation is preliminary and confidential. It is subject to change. Quadric does not give any warranty express or implied that the contents will be complete or accurate or up to date. The company shall not be liable for any loss, actions, claims, proceedings, demands or costs or damages whatsoever or howsoever caused arising directly or indirectly in connection with or arising out of the use of this material.

Sign in to your account

Don't have an account? Create an Account
By signing in, you are agreeing to our Terms of Use and Privacy Policy.

Develop.

Simulate.

Profile.

Collaborate.

We use cookies to enhance your browsing experience, and analyze our traffic.
By clicking "Accept All", you consent to our use of cookies.