diff options
| author | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:12:36 +0200 |
|---|---|---|
| committer | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:12:36 +0200 |
| commit | b4c345e6a5fa929ba20eac19183b9c777055f52d (patch) | |
| tree | 23a0232f2526c5ab7f53391609a8a0a5960865f0 /Layer/InputLayer.cpp | |
Initial commit
Diffstat (limited to 'Layer/InputLayer.cpp')
| -rw-r--r-- | Layer/InputLayer.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Layer/InputLayer.cpp b/Layer/InputLayer.cpp new file mode 100644 index 0000000..79c0751 --- /dev/null +++ b/Layer/InputLayer.cpp @@ -0,0 +1,31 @@ +#include "./InputLayer.h"
+/**
+ * Constructeur par taille
+ * @method InputLayer::InputLayer
+ * @param taille Nombre de neurones dans le layer
+ */
+InputLayer::InputLayer(int taille,FonctionActivation::EnumFonctionActivation fct){
+ membres =std::vector<Neurone *> (taille);
+ nbNeurone = taille;
+ input=std::vector<double>(taille);
+ output= std::vector<double>(taille);
+ for (int i = 0; i < taille; i ++){
+ membres[i] = new Neurone(1, new std::vector<double>(1,1),fct);
+ }
+}
+/**
+ * Méthode de propagation en avant
+ * @method InputLayer::fire
+ * @param input Vecteur en entrées
+ * @param k Coefficient de sigmoid
+ * @return Valeur d'activation
+ */
+std::vector<double> InputLayer::fire(std::vector<double> input, double k){
+ for (unsigned int i =0; i < input.size(); i ++){
+ this->input[i] = input[i];
+ }
+ for (int i = 0 ; i < nbNeurone; i ++){
+ output[i]=membres[i]->fire({input[i]},k); //faut il activer ou non? OUI!
+ }
+ return output;
+}
|
