Blob Blame Raw
#ifndef FUNC_INC_CPP
#define FUNC_INC_CPP


#include "common.inc.cpp"



typedef void Func(Neuron &n, AccumReal s);


inline void funcSigmoidExp(Neuron &n, AccumReal s) {
  //if (s > 5) s = 5; else if (s < -5) s = -5;
  AccumReal ss = 1/(1 + std::exp(-s)); n.v = ss; n.d = ss * (1-ss);
}


inline void funcSigmoidExp2(Neuron &n, AccumReal s) {
  //if (s > 5) s = 5; else if (s < -5) s = -5;
  AccumReal ss = 1/(1 + std::exp(-s)); n.v = ss; n.d = 0;//ss * (1-ss) * 0.1;
}


inline void funcReLU(Neuron &n, AccumReal s)
  { n.v = s > 0 ? s : 0; n.d = s > 0; }



#endif