// Copyright 2016, Tobias Hermann. // https://github.com/Dobiasd/frugally-deep // Distributed under the MIT License. // (See accompanying LICENSE file or at // https://opensource.org/licenses/MIT) #pragma once #include "fdeep/layers/activation_layer.hpp" #include #include namespace fdeep { namespace internal { class relu6_layer : public activation_layer { public: explicit relu6_layer(const std::string& name) : activation_layer(name) { } protected: tensor3 transform_input(const tensor3& in_vol) const override { auto activation_function = [](float_type x) -> float_type { return std::min(std::max(x, 0), 6); }; return transform_tensor3(activation_function, in_vol); } }; } } // namespace fdeep, namespace internal