blob: 8abb99ac24513e73f0a11c3c2374d29fc993a174 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#pragma once
#include <neuralnet/types.h>
#include <math.h>
// General epsilon for comparing values.
static const R EPS = 1e-10;
// Epsilon for comparing network weights after training.
static const R WEIGHT_EPS = 0.01;
// Epsilon for comparing network outputs after training.
static const R OUTPUT_EPS = 0.01;
static inline bool double_eq(double a, double b, double eps) {
return fabs(a - b) <= eps;
}
static inline R lerp(R a, R b, R t) {
return a + t*(b-a);
}
|