Skip to content

Commit 7ced9d5

Browse files
committed
add tanh activation
1 parent 00713c3 commit 7ced9d5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

keras_model.cc

+4
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ keras::DataChunk* keras::LayerActivation::compute_output(keras::DataChunk* dc) {
214214
for(unsigned int k = 0; k < y.size(); ++k) {
215215
y[k] = 1/(1+exp(-y[k]));
216216
}
217+
} else if(m_activation_type == "tanh") {
218+
for(unsigned int k = 0; k < y.size(); ++k) {
219+
y[k] = tanh(y[k]);
220+
}
217221
} else {
218222
keras::missing_activation_impl(m_activation_type);
219223
}

test_run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
echo 'Test for CNN dumping'
44

55
# Parameters
6-
INPUT_ARCH="../../keras2cpp_nets/th/52c55ce6-201b-4ce4-ad53-68b86d79804f.cnn.architecture.json"
7-
INPUT_WEIGHTS="../../keras2cpp_nets/th/52c55ce6-201b-4ce4-ad53-68b86d79804f.cnn.model.h5"
6+
INPUT_ARCH="example/my_nn_arch.json"
7+
INPUT_WEIGHTS="example/my_nn_weights.h5"
88

99
DUMPED_CNN="test_cnn.dumped"
1010
DATA_SAMPLE="test_random_input.dat"

0 commit comments

Comments
 (0)