mirror of
https://github.com/Sosokker/CPP-Neural-Network.git
synced 2025-12-19 02:24:03 +01:00
Fix Indentation
This commit is contained in:
parent
fde93f30ac
commit
dcd8ff7172
@ -1,23 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
class Layer {
|
class Layer {
|
||||||
public:
|
public:
|
||||||
virtual void forward(const std::vector<double>& inputs, bool training) = 0;
|
virtual void forward(const std::vector<double>& inputs, bool training) = 0;
|
||||||
virtual void backward(std::vector<double>& dvalues) = 0;
|
virtual void backward(std::vector<double>& dvalues) = 0;
|
||||||
virtual std::pair<std::vector<std::vector<double>>, std::vector<std::vector<double>>> get_parameters() const = 0;
|
virtual std::pair<std::vector<std::vector<double>>, std::vector<std::vector<double>>> get_parameters() const = 0;
|
||||||
virtual void set_parameters(const std::vector<std::vector<double>>& weights, const std::vector<std::vector<double>>& biases) = 0;
|
virtual void set_parameters(const std::vector<std::vector<double>>& weights, const std::vector<std::vector<double>>& biases) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layer_Dense : public Layer {
|
class Layer_Dense : public Layer {
|
||||||
private:
|
private:
|
||||||
double weight_regularizer_l1, weight_regularizer_l2,
|
double weight_regularizer_l1, weight_regularizer_l2,
|
||||||
bias_regularizer_l1, bias_regularizer_l2;
|
bias_regularizer_l1, bias_regularizer_l2;
|
||||||
std::vector<std::vector<double>> weights, biases;
|
std::vector<std::vector<double>> weights, biases;
|
||||||
std::vector<double> inputs;
|
std::vector<double> inputs;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Layer_Dense(int n_inputs, int n_neurons,
|
Layer_Dense(int n_inputs, int n_neurons,
|
||||||
double weight_regularizer_l1,
|
double weight_regularizer_l1,
|
||||||
double weight_regularizer_l2,
|
double weight_regularizer_l2,
|
||||||
@ -28,26 +28,24 @@
|
|||||||
void backward(std::vector<double>& dvalues) override;
|
void backward(std::vector<double>& dvalues) override;
|
||||||
std::pair<std::vector<std::vector<double>>, std::vector<std::vector<double>>> get_parameters() const override;
|
std::pair<std::vector<std::vector<double>>, std::vector<std::vector<double>>> get_parameters() const override;
|
||||||
void set_parameters(const std::vector<std::vector<double>>& weights, const std::vector<std::vector<double>>& biases) override;
|
void set_parameters(const std::vector<std::vector<double>>& weights, const std::vector<std::vector<double>>& biases) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layer_Dropout : public Layer {
|
class Layer_Dropout : public Layer {
|
||||||
private:
|
private:
|
||||||
double rate;
|
double rate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Layer_Dropout(double rate);
|
Layer_Dropout(double rate);
|
||||||
|
|
||||||
void forward(const std::vector<double>& inputs, bool training) override;
|
void forward(const std::vector<double>& inputs, bool training) override;
|
||||||
void backward(std::vector<double>& dvalues) override;
|
void backward(std::vector<double>& dvalues) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Layer_Input {
|
class Layer_Input {
|
||||||
private:
|
private:
|
||||||
std::vector<double> output;
|
std::vector<double> output;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void forward(const std::vector<double>& inputs, bool training);
|
void forward(const std::vector<double>& inputs, bool training);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add other Layer classes as needed
|
|
||||||
Loading…
Reference in New Issue
Block a user