blob: 116ce1c8800a2baaceb3a09a6a61f3d6876b4db7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef NEURAL_SLOPE_STD_H
#define NEURAL_SLOPE_STD_H
#include <math.h>
#include "neural/slope.h"
namespace Neural
{
template<typename sigtype>
sigtype tpltanh( sigtype sInput );
template<>
float tpltanh<float>( float sInput )
{
return tanhf( sInput );
}
template<>
double tpltanh<double>( double sInput )
{
return tanh( sInput );
}
template<>
long double tpltanh<long double>( long double sInput )
{
return tanhl( sInput );
}
template<typename sigtype>
class SlopeStd : public Slope<sigtype>
{
public:
SlopeStd( sigtype sSlope=1.0 ) :
sSlope( sSlope )
{
}
virtual ~SlopeStd()
{
}
virtual sigtype operator()( sigtype sInput )
{
return tpltanh<sigtype>(2.0*sSlope*sInput);
}
private:
sigtype sSlope;
};
};
#endif
|