-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathActivations.h
51 lines (43 loc) · 993 Bytes
/
Activations.h
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
//
// Activations.h
// ConvNet
//
// Created by Márton Szemenyei on 2017. 09. 28..
// Copyright © 2017. Márton Szemenyei. All rights reserved.
//
#ifndef Activations_h
#define Activations_h
#include <cstdint>
typedef enum
{
RELU=0,
SIGMOID,
LEAKYRELU,
TANH,
NONE
} ACTIVATION;
void ReLU( float *inout, int32_t N );
void sigmoid( float *inout, int32_t N );
void leakyReLU( float *inout, int32_t N );
void tanh( float *inout, int32_t N );
void softmax(const float *input, int32_t n, int32_t channels, float *output);
inline void activate( float * inout, int32_t N, ACTIVATION act )
{
switch (act) {
case RELU:
ReLU(inout, N);
break;
case SIGMOID:
sigmoid(inout, N);
break;
case LEAKYRELU:
leakyReLU(inout, N);
break;
case TANH:
tanh(inout, N);
break;
case NONE:
break;
}
}
#endif /* Activations_h */