Class Sigmoid#

Class Documentation#

class Sigmoid#

Sigmoid activation function.

A class that implements the Sigmoid activation function.

\(\sigma(x) = \frac{1}{1 + e^{-x}}\)

\(\sigma'(x) = x(1 - x)\)

Public Functions

Sigmoid() = default#
template<typename T>
inline auto forward(const T &src) const#

Applies the Sigmoid activation function to the input array and returns the result.

Template Parameters
  • ShapeType – The type of the shape of the input array.

  • StorageType – The type of the storage of the input array.

Parameters

src – The input array to apply the activation function to.

Returns

A new array with the result of applying the Sigmoid activation function to the input array.

template<typename T>
inline auto backward(const T &src) const#
template<typename T>
inline auto operator()(const T &src) const#
template<typename ShapeType, typename StorageScalar>
inline void forward(array::ArrayContainer<ShapeType, Storage<StorageScalar>> &dst, const array::ArrayContainer<ShapeType, Storage<StorageScalar>> &src) const#

Applies the Sigmoid activation function to the input array and stores the result in the output array.

Template Parameters
  • ShapeType – The type of the shape of the input and output arrays.

  • StorageScalar – The type of the scalar values stored in the input and output arrays.

Parameters
  • dst – The output array to store the result of applying the Sigmoid activation function to the input array.

  • src – The input array to apply the activation function to.

template<typename ShapeType, typename StorageScalar>
inline void backward(array::ArrayContainer<ShapeType, Storage<StorageScalar>> &dst, const array::ArrayContainer<ShapeType, Storage<StorageScalar>> &src) const#
template<typename ShapeType, typename StorageScalar, size_t... Dims>
inline void forward(array::ArrayContainer<ShapeType, FixedStorage<StorageScalar, Dims...>> &dst, const array::ArrayContainer<ShapeType, FixedStorage<StorageScalar, Dims...>> &src) const#
template<typename ShapeType, typename StorageScalar, size_t... Dims>
inline void backward(array::ArrayContainer<ShapeType, FixedStorage<StorageScalar, Dims...>> &dst, const array::ArrayContainer<ShapeType, FixedStorage<StorageScalar, Dims...>> &src) const#
template<typename ShapeType, typename StorageScalar, typename descriptor, typename Functor, typename ...Args>
inline void forward(array::ArrayContainer<ShapeType, Storage<StorageScalar>> &dst, const detail::Function<descriptor, Functor, Args...> &src) const#
template<typename ShapeType, typename StorageScalar, typename descriptor, typename Functor, typename ...Args>
inline void backward(array::ArrayContainer<ShapeType, Storage<StorageScalar>> &dst, const detail::Function<descriptor, Functor, Args...> &src) const#
template<typename ShapeType, typename StorageScalar, typename Src, typename std::enable_if_t<std::is_same_v<typename typetraits::TypeInfo<Src>::Backend, backend::CUDA>, int> = 0>
inline void forward(array::ArrayContainer<ShapeType, CudaStorage<StorageScalar>> &dst, const Src &src) const#
template<typename ShapeType, typename StorageScalar, typename Src, typename std::enable_if_t<std::is_same_v<typename typetraits::TypeInfo<Src>::Backend, backend::CUDA>, int> = 0>
inline void backward(array::ArrayContainer<ShapeType, CudaStorage<StorageScalar>> &dst, const Src &src) const#