diff --git a/dlib/dnn/layers.h b/dlib/dnn/layers.h index 04bbec11d9..77ff918a6e 100644 --- a/dlib/dnn/layers.h +++ b/dlib/dnn/layers.h @@ -2136,30 +2136,21 @@ namespace dlib // ---------------------------------------------------------------------------------------- - template + template class dropout_rate_ : public dropout_ { public: - explicit dropout_rate_() : dropout_(DROP_RATE) + explicit dropout_rate_() : dropout_(static_cast(DROP_RATE_PERCENT) / 100.0f) { - DLIB_CASSERT(0 <= DROP_RATE && DROP_RATE <= 1, - "DROP_RATE must be between 0 and 1, inclusive."); + static_assert(DROP_RATE_PERCENT >= 0 && DROP_RATE_PERCENT <= 100, + "DROP_RATE_PERCENT must be between 0 and 100, inclusive."); } }; - - template + + template using dropout_rate = add_layer, SUBNET>; - - template - using dropout_rate_5 = add_layer, SUBNET>; - template - using dropout_rate_10 = add_layer, SUBNET>; - template - using dropout_rate_15 = add_layer, SUBNET>; - template - using dropout_rate_20 = add_layer, SUBNET>; template - using dropout_rate_25 = add_layer, SUBNET>; + using dropout_10 = add_layer, SUBNET>; // ---------------------------------------------------------------------------------------- diff --git a/dlib/dnn/layers_abstract.h b/dlib/dnn/layers_abstract.h index d5cf663c5b..3cd5486ecd 100644 --- a/dlib/dnn/layers_abstract.h +++ b/dlib/dnn/layers_abstract.h @@ -1435,7 +1435,7 @@ namespace dlib // ---------------------------------------------------------------------------------------- - template + template class dropout_rate_ : public dropout_ { /*! @@ -1451,7 +1451,7 @@ namespace dlib flexibility and clarity in the network architecture definition. TEMPLATE PARAMETERS - - DROP_RATE: A float value between 0 and 1 that specifies the dropout rate. + - DROP_RATE_PERCENT: A int value between 0 and 100 that specifies the dropout rate. This value is set at compile-time and cannot be changed during runtime. !*/ @@ -1464,7 +1464,7 @@ namespace dlib !*/ }; - template + template using dropout_rate = add_layer, SUBNET>; // ----------------------------------------------------------------------------------------