From dcd8ff7172926c0c70f44ca1c6f9c310b7de017b Mon Sep 17 00:00:00 2001 From: sosokker Date: Tue, 22 Aug 2023 01:12:42 +0700 Subject: [PATCH] Fix Indentation --- src/Layers/Layers.hpp | 84 +++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/src/Layers/Layers.hpp b/src/Layers/Layers.hpp index bace51f..9de4a44 100644 --- a/src/Layers/Layers.hpp +++ b/src/Layers/Layers.hpp @@ -1,53 +1,51 @@ - #pragma once - #include - #include +#pragma once +#include +#include - class Layer { - public: - virtual void forward(const std::vector& inputs, bool training) = 0; - virtual void backward(std::vector& dvalues) = 0; - virtual std::pair>, std::vector>> get_parameters() const = 0; - virtual void set_parameters(const std::vector>& weights, const std::vector>& biases) = 0; - }; +class Layer { +public: + virtual void forward(const std::vector& inputs, bool training) = 0; + virtual void backward(std::vector& dvalues) = 0; + virtual std::pair>, std::vector>> get_parameters() const = 0; + virtual void set_parameters(const std::vector>& weights, const std::vector>& biases) = 0; +}; - class Layer_Dense : public Layer { - private: - double weight_regularizer_l1, weight_regularizer_l2, - bias_regularizer_l1, bias_regularizer_l2; - std::vector> weights, biases; - std::vector inputs; +class Layer_Dense : public Layer { +private: + double weight_regularizer_l1, weight_regularizer_l2, + bias_regularizer_l1, bias_regularizer_l2; + std::vector> weights, biases; + std::vector inputs; - public: - Layer_Dense(int n_inputs, int n_neurons, - double weight_regularizer_l1, - double weight_regularizer_l2, - double bias_regularizer_l1, - double bias_regularizer_l2); +public: + Layer_Dense(int n_inputs, int n_neurons, + double weight_regularizer_l1, + double weight_regularizer_l2, + double bias_regularizer_l1, + double bias_regularizer_l2); - void forward(const std::vector& inputs, bool training) override; - void backward(std::vector& dvalues) override; - std::pair>, std::vector>> get_parameters() const override; - void set_parameters(const std::vector>& weights, const std::vector>& biases) override; - }; + void forward(const std::vector& inputs, bool training) override; + void backward(std::vector& dvalues) override; + std::pair>, std::vector>> get_parameters() const override; + void set_parameters(const std::vector>& weights, const std::vector>& biases) override; +}; - class Layer_Dropout : public Layer { - private: - double rate; +class Layer_Dropout : public Layer { +private: + double rate; - public: - Layer_Dropout(double rate); +public: + Layer_Dropout(double rate); - void forward(const std::vector& inputs, bool training) override; - void backward(std::vector& dvalues) override; - }; + void forward(const std::vector& inputs, bool training) override; + void backward(std::vector& dvalues) override; +}; - class Layer_Input { - private: - std::vector output; +class Layer_Input { +private: + std::vector output; - public: - void forward(const std::vector& inputs, bool training); - }; - - // Add other Layer classes as needed +public: + void forward(const std::vector& inputs, bool training); +}; \ No newline at end of file