Dense Layer, Add
added the dense layer with a forward functions. I also made the add functions for most cases.
This commit is contained in:
@@ -40,6 +40,9 @@
|
||||
#include <tensor/vector.hpp>
|
||||
#include <tensor/matrix.hpp>
|
||||
#include <io/print_tensor.hpp>
|
||||
#include <math/matmul.hpp>
|
||||
#include <neural_network/layer/layer_dense.hpp>
|
||||
#include <math/add.hpp>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// DEFINE DESCRIPTION
|
||||
@@ -52,11 +55,11 @@
|
||||
// VARIABLE DESCRIPTION
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// Variable difinition like:
|
||||
panic::real_t x = 2.4;
|
||||
panic::types::real_t x = 2.4;
|
||||
|
||||
panic::tensor::real_vector a(3);
|
||||
panic::tensor::uint_vector b(3);
|
||||
panic::tensor::int_vector c(10);
|
||||
panic::tensor::int_vector c(3);
|
||||
|
||||
panic::tensor::real_matrix A(2,2, 1);
|
||||
panic::tensor::uint_matrix B(2,2, 2);
|
||||
@@ -90,6 +93,19 @@ int main(void) {
|
||||
panic::io::print_matrix(B);
|
||||
panic::io::print_matrix(C);
|
||||
|
||||
panic::tensor::real_matrix A1(100, 100, 0.999/100);
|
||||
panic::tensor::real_matrix A2(100, 100, 100);
|
||||
|
||||
|
||||
for (panic::types::uint_t i = 0; i < 5; ++i)
|
||||
{
|
||||
std::cout << A2(0,0) << std::endl;
|
||||
A2 = panic::math::matmul(A1, A2);
|
||||
}
|
||||
|
||||
panic::tensor::real_matrix B1(25, 100, 100);
|
||||
panic::neural_network::layer_dense dense(100,10);
|
||||
std::cout << dense.forward(B1) << std::endl;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user