Deep Learning Visualizer
Interactive visualization of basic applications of deep learning
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1#pragma once
2
8#include <cmath>
9
10namespace shared {
11
12inline float sigmoid(float x) {
13 // 1/(1+e^(-x))
14 return 1.0f / (1.0f + std::exp(-x));
15}
16
17inline float d_sigmoid(float x) {
18 float a = sigmoid(x);
19 return a * (1 - a);
20}
21
22inline float relu(float x) {
23 return std::fmax(0.0f, x);
24}
25
26inline float d_relu(float x) {
27 return x > 0.0f ? 1.0f : 0.0f;
28}
29
30}; // namespace shared