Compute Library
 21.11
brelu< T, S > Struct Template Reference

Bounded RELU activation object. More...

#include <NEActivationFunctionDetail.h>

Public Types

using ExactType = typename wrapper::traits::neon_vector< T, S >::type
 SIMD vector type. More...
 
using ExactTagType = typename wrapper::traits::neon_vector< T, S >::tag_type
 SIMD vector tag type. More...
 

Public Member Functions

 brelu (ActivationLayerInfo act_info)
 Construct a bounded RELU activation object. More...
 
void operator() (ExactType &vval)
 Run activation function. More...
 
void operator() (T &val)
 Run activation function. More...
 

Data Fields

const T alpha
 
const ExactType vzero
 Scalar alpha. More...
 
const ExactType valpha
 Vector of zeroes. More...
 

Detailed Description

template<typename T, int S>
struct arm_compute::detail::brelu< T, S >

Bounded RELU activation object.

Definition at line 229 of file NEActivationFunctionDetail.h.

Member Typedef Documentation

◆ ExactTagType

using ExactTagType = typename wrapper::traits::neon_vector<T, S>::tag_type

SIMD vector tag type.

Definition at line 234 of file NEActivationFunctionDetail.h.

◆ ExactType

using ExactType = typename wrapper::traits::neon_vector<T, S>::type

SIMD vector type.

Definition at line 232 of file NEActivationFunctionDetail.h.

Constructor & Destructor Documentation

◆ brelu()

brelu ( ActivationLayerInfo  act_info)
inlineexplicit

Construct a bounded RELU activation object.

Parameters
[in]act_infoActivation layer information.

Definition at line 240 of file NEActivationFunctionDetail.h.

References arm_compute::wrapper::vdup_n().

241  : alpha(act_info.a()),
242  vzero(wrapper::vdup_n(static_cast<T>(0), ExactTagType{})),
243  valpha(wrapper::vdup_n(static_cast<T>(act_info.a()), ExactTagType{}))
244  {
245  }
const ExactType vzero
Scalar alpha.
const ExactType valpha
Vector of zeroes.
uint8x8_t vdup_n(uint8_t value, traits::vector_64_tag)
Definition: dup_n.h:41
typename wrapper::traits::neon_vector< T, S >::tag_type ExactTagType
SIMD vector tag type.

Member Function Documentation

◆ operator()() [1/2]

void operator() ( ExactType vval)
inline

Run activation function.

Parameters
[in]vvalVector of values.

Definition at line 251 of file NEActivationFunctionDetail.h.

References arm_compute::wrapper::vmax(), and arm_compute::wrapper::vmin().

252  {
253  vval = wrapper::vmin(valpha, wrapper::vmax(vzero, vval));
254  }
const ExactType vzero
Scalar alpha.
uint8x8_t vmin(const uint8x8_t &a, const uint8x8_t &b)
Definition: min.h:39
const ExactType valpha
Vector of zeroes.
uint8x8_t vmax(const uint8x8_t &a, const uint8x8_t &b)
Definition: max.h:39

◆ operator()() [2/2]

void operator() ( T &  val)
inline

Run activation function.

Parameters
[in]valScalar value.

Definition at line 260 of file NEActivationFunctionDetail.h.

261  {
262  val = std::min(alpha, std::max(static_cast<T>(0), val));
263  }

Field Documentation

◆ alpha

const T alpha

Definition at line 265 of file NEActivationFunctionDetail.h.

◆ valpha

const ExactType valpha

Vector of zeroes.

Definition at line 267 of file NEActivationFunctionDetail.h.

◆ vzero

const ExactType vzero

Scalar alpha.

Definition at line 266 of file NEActivationFunctionDetail.h.


The documentation for this struct was generated from the following file: