model.cpp/hpp
I made the model struct to store layers. I'm still missing the backward functions, but it's functional
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
* Module Name: neural_network
|
||||
* File Name: layer_dense.cpp
|
||||
* Revision: 0.1.0
|
||||
* Date: 23-06-2026
|
||||
* Date: 28-07-2026
|
||||
* Author: Michelle Bausager
|
||||
*
|
||||
* Description:
|
||||
@@ -37,25 +37,25 @@
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
#include <neural_network/layer/layer_dense.hpp>
|
||||
#include <config/omp.hpp>
|
||||
|
||||
#include <math/matmul.hpp>
|
||||
#include <math/add.hpp>
|
||||
#include <random/uniform.hpp>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// DEFINE DESCRIPTION
|
||||
// PRIVATE CONSTANTS
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Minimum number of element operations before using the OpenMP-enabled loop.
|
||||
*
|
||||
* Small vectors and matrices are kept serial because the overhead of starting
|
||||
* worker threads can be larger than the work itself.
|
||||
*/
|
||||
static const panic::types::uint_t layer_dense_omp_min_size = 500;
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// INPLEMENTATION
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// TYPE DESCRIPTION
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// VARIABLE DESCRIPTION
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
static const panic::types::uint_t layer_dense_omp_min_size = 10000;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// FUNCTION PROTOTYPE
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
namespace panic{
|
||||
namespace neural_network{
|
||||
|
||||
@@ -76,27 +76,19 @@ layer_dense::layer_dense() {
|
||||
// Constructor Name : panic::neural_network::layer_dense
|
||||
//
|
||||
// Description:
|
||||
// Creates an empty layer.
|
||||
// Creates an empty layer with neurons.
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
layer_dense::layer_dense(panic::types::uint_t input_size, panic::types::uint_t neurons) {
|
||||
weights.resize(input_size, neurons);
|
||||
panic::random::uniform(weights);
|
||||
//panic::math::matmul(weights, 0.01f);
|
||||
|
||||
biases.resize(neurons);
|
||||
panic::random::uniform(biases);
|
||||
|
||||
outputs.resize(0,0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// Deconstructor Name : panic::tensor::vector::~vector
|
||||
//
|
||||
// Description:
|
||||
// Deletes the data and releases the memory.
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
//template <typename T>
|
||||
//vector<T>::~vector(){
|
||||
// delete[] data;
|
||||
//
|
||||
// data = 0;
|
||||
// length = 0;
|
||||
//}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
// Function Name : panic::neural_network::layer_dense.forward
|
||||
|
||||
Reference in New Issue
Block a user