Starting on the model.h, but need to make layer structs and structs for loss and optimizers
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "core/omp_config.h"
|
||||
|
||||
#include "utils/vector.h"
|
||||
#include "utils/matrix.h"
|
||||
#include "modules/neural_networks/layers/Layer.h"
|
||||
|
||||
|
||||
|
||||
namespace neural_networks{
|
||||
|
||||
template <typename T>
|
||||
struct Activation_Linear : Layer<T>{
|
||||
|
||||
utils::Matrix<T> _inputs;
|
||||
utils::Matrix<T> outputs;
|
||||
|
||||
utils::Matrix<T> dinputs;
|
||||
|
||||
void forward(const utils::Matrix<T>& inputs){
|
||||
_inputs = inputs;
|
||||
outputs = inputs;
|
||||
}
|
||||
void backward(const utils::Matrix<T>& dvalues){
|
||||
|
||||
dinputs = dvalues;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // end namespace neural_networks
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
#include "utils/vector.h"
|
||||
#include "utils/matrix.h"
|
||||
|
||||
#include "modules/neural_networks/layers/Layer.h"
|
||||
|
||||
namespace neural_networks{
|
||||
|
||||
template <typename T>
|
||||
struct Activation_ReLU{
|
||||
struct Activation_ReLU : Layer<T>{
|
||||
|
||||
utils::Matrix<T> _inputs;
|
||||
utils::Matrix<T> outputs;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "utils/vector.h"
|
||||
#include "utils/matrix.h"
|
||||
#include "modules/neural_networks/layers/Layer.h"
|
||||
|
||||
#include "numerics/neg.h"
|
||||
#include "numerics/exp.h"
|
||||
@@ -15,7 +16,7 @@
|
||||
namespace neural_networks{
|
||||
|
||||
template <typename T>
|
||||
struct Activation_Sigmoid{
|
||||
struct Activation_Sigmoid : Layer<T>{
|
||||
|
||||
utils::Matrix<T> _inputs;
|
||||
utils::Matrix<T> outputs;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "utils/vector.h"
|
||||
#include "utils/matrix.h"
|
||||
#include "modules/neural_networks/layers/Layer.h"
|
||||
|
||||
#include "numerics/max.h"
|
||||
#include "numerics/sub.h"
|
||||
@@ -15,7 +16,7 @@
|
||||
namespace neural_networks{
|
||||
|
||||
template <typename T>
|
||||
struct Activation_Softmax{
|
||||
struct Activation_Softmax : Layer<T>{
|
||||
|
||||
//utils::Matrix<T> exp_values;
|
||||
//utils::Matrix<T> probabilities;
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "utils/vector.h"
|
||||
#include "utils/matrix.h"
|
||||
#include "modules/neural_networks/layers/Layer.h"
|
||||
|
||||
#include "numerics/max.h"
|
||||
#include "numerics/sub.h"
|
||||
@@ -17,7 +18,7 @@
|
||||
namespace neural_networks{
|
||||
|
||||
template <typename Td, typename Ti>
|
||||
struct Activation_Softmax_Loss_CategoricalCrossentropy{
|
||||
struct Activation_Softmax_Loss_CategoricalCrossentropy : Layer<Td>{
|
||||
|
||||
neural_networks::Activation_Softmax<Td> activation;
|
||||
neural_networks::Loss_CategoricalCrossentrophy<Td, Ti> loss;
|
||||
|
||||
Reference in New Issue
Block a user