Deepity
Ultra-fast, SIMD-accelerated Predictive Coding
Loading...
Searching...
No Matches
Sigmoid.h File Reference

Logistic sigmoid and Elliot ("fast") sigmoid, and their derivatives (plain and two-buffer variants), with AVX512/AVX2/SSE paths and a scalar tail. More...

#include <cassert>
#include <cmath>
#include <cstddef>
#include <immintrin.h>
#include <omp.h>
#include <sleef.h>
#include <deepity/utils/activations/ActivationMacros.h>

Go to the source code of this file.

Namespaces

namespace  Deep
 This file exists to provide both Tensor.h and IComputeBackend.h with device types without introducing circular dependencies.

Functions

static void Deep::sigmoid (float *RESTRICT x, const size_t n) noexcept
 Implements the Logistic Sigmoid approximation, i.e. S(x) = 1 / (1 + e^(-x)).
void Deep::e_sigmoid (float *RESTRICT x, const size_t n) noexcept
 Implements the Elliot Sigmoid approximation, i.e. S(x) = (1/2)((x / (1 + |x|)) + 1).
static void Deep::dSigmoid (float *RESTRICT x, const size_t n, bool activated=false) noexcept
 In-place logistic sigmoid derivative: sigmoid(x)*(1-sigmoid(x)).
static void Deep::dSigmoidInto (float *RESTRICT dst, const float *RESTRICT src, const size_t n) noexcept
 Two-buffer, single-pass sigmoid derivative: reads src, writes sigmoid(src)*(1-sigmoid(src)) directly into dst. Computes the sigmoid into a register and derives from that same register immediately – one read of src, one write to dst, no intermediate array pass.
static void Deep::d_eSigmoid (float *RESTRICT x, const size_t n, const bool activated=false) noexcept
 In-place Elliot sigmoid derivative.
static void Deep::d_eSigmoidInto (float *RESTRICT dst, const float *RESTRICT src, const size_t n) noexcept
 Two-buffer, single-pass Elliot sigmoid derivative: reads src, writes the derivative directly into dst.

Detailed Description

Logistic sigmoid and Elliot ("fast") sigmoid, and their derivatives (plain and two-buffer variants), with AVX512/AVX2/SSE paths and a scalar tail.