There was an error while loading. Please reload this page.
1 parent 5f26c03 commit 1a404d1Copy full SHA for 1a404d1
1 file changed
include/fdeep/layers/relu_layer.hpp
@@ -8,6 +8,8 @@
8
9
#include "fdeep/layers/activation_layer.hpp"
10
11
+#include <algorithm>
12
+#include <limits>
13
#include <string>
14
15
namespace fdeep {
@@ -29,6 +31,13 @@ namespace internal {
29
31
protected:
30
32
tensor transform_input(const tensor& in_vol) const override
33
{
34
+ if (negative_slope_ == static_cast<float_type>(0) &&
35
+ threshold_ == static_cast<float_type>(0) &&
36
+ max_value_ == std::numeric_limits<float_type>::max()) {
37
+ return transform_tensor([](float_type x) -> float_type {
38
+ return std::max(static_cast<float_type>(0), x);
39
+ }, in_vol);
40
+ }
41
return transform_tensor([&](float_type x) -> float_type {
42
if (x >= max_value_)
43
return max_value_;
0 commit comments