AIfES 2  2.0.0
ailayer_tanh Struct Reference

General Tanh layer struct. More...

#include <ailayer_tanh.h>

Data Fields

ailayer_t base
 Inherited field members from general ailayer struct.
 
Math functions

Required data type specific math functions

void(* tanh )(const aitensor_t *x, aitensor_t *result)
 Required math function: Tanh. More...
 
void(* d_tanh )(const aitensor_t *tanh_x, aitensor_t *result)
 Required math function: Derivative of tanh. More...
 
void(* multiply )(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
 Required math function: Element wise tensor multiplication. More...
 

Detailed Description

General Tanh layer struct.

Field Documentation

◆ d_tanh

void(* d_tanh) (const aitensor_t *tanh_x, aitensor_t *result)

Required math function: Derivative of tanh.

Requires a math function that calculates the element wise tanh derivative of a tensor:

\[ result_{i} = tanh'(x_{i}) = 1 - tanh(x_{i})^2 \]

Parameters
tanh_xN-dimensional tensor with the tanh values \( tanh(x_{i}) \) (input)
resultN-dimensional tensor (output)

◆ multiply

void(* multiply) (const aitensor_t *a, const aitensor_t *b, aitensor_t *result)

Required math function: Element wise tensor multiplication.

Requires a math function that multiplies two tensors element wise:

\[ result = a \circ b \]

◆ tanh

void(* tanh) (const aitensor_t *x, aitensor_t *result)

Required math function: Tanh.

Requires a math function that calculates the element wise tanh of a tensor:

\[ result_{i} = \tanh(x_{i}) = \frac{e^{x_i} - e^{-x_i}}{e^{x_i} + e^{-x_i}} \]

Parameters
xN-dimensional tensor (input)
resultN-dimensional tensor (output)

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