OCR / XOR / NN / NN_Tools / activation.c
activation.c
Raw
#include "activation.h"

float Sigmoid(float val)
{
	return 1 / (1 + exp(-val));
}

float DSigmoid(float val)
{
	return Sigmoid(val) * (1 - Sigmoid(val));
}

float Tanh(float val)
{
	return (float)tanh(val);
}

float DTanh(float val)
{
	return 1 - pow(tanh(val), 2);
}