Skip to content

Commit

Permalink
Fixing example
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Nov 14, 2023
1 parent 1ef0dae commit 4a3e424
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/custom_layer_model/GatedActivation_STL.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ class GatedActivation
/** Performs forward propagation for gated activation. */
inline void forward(const T (&ins)[in_size]) noexcept
{
const auto sigmoid = [] (T x)
{
return (T) 1 / ((T) 1 + std::exp (-x));
};

for(int i = 0; i < out_size; ++i)
outs[i] = std::tanh(ins[i]) * RTNeural::sigmoid(ins[i + out_size]);
outs[i] = std::tanh(ins[i]) * sigmoid(ins[i + out_size]);
}

T outs alignas(RTNEURAL_DEFAULT_ALIGNMENT)[out_size];
Expand Down

0 comments on commit 4a3e424

Please sign in to comment.