mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
46 lines
1007 B
C++
46 lines
1007 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2020 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** net.cxx : neural net tester
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <iostream>
|
|
using std::cin;
|
|
using std::cout;
|
|
|
|
#include <vector>
|
|
using std::vector;
|
|
|
|
#include "ml.hpp"
|
|
|
|
int main() {
|
|
|
|
const int insize = 4, outsize = 2;
|
|
|
|
{
|
|
auto layer = network_layer(insize,outsize,0.,1.);
|
|
data_vector
|
|
indata(insize),
|
|
outdata(outsize);
|
|
cout << "Layer with zero coefficients and 1 bias" << '\n';
|
|
layer.apply(indata,outdata,true);
|
|
cout << '\n';
|
|
}
|
|
|
|
{
|
|
auto net = network( {insize,outsize} );
|
|
cout << "Network with " << net.depth() << " layers" << '\n';
|
|
cout << '\n';
|
|
data_vector
|
|
indata(insize),
|
|
outdata(outsize);
|
|
net.apply(indata,outdata,true);
|
|
}
|
|
|
|
return 0;
|
|
}
|