Programa para el testeo de las funciones Fully Connected Layer.Para compilar o código example_fclayer_predict.cpp:
g++ -static -o example_fclayer_predict example_fclayer_predict.cpp -lpdsramm -lpdsnnmm
Para executar o programa:
./example_fclayer_predict
Retornando por consola:
<<Layer>>:
Nin: 5
Nout: 2
FuncAct: 0x7f963a8bf3e0
DFuncAct: 0x7f963a8bf420
W:
0.53763086114909 0.36954202465847 0.56382463392773 -0.87250749271152 -0.22063468437125 -1.3938059648353
-0.7925277058445 2.1272209970701 -1.045855489402 0.86048864346136 0.74207001785205 1.1751184865889
<<Out>>
0.99695233289611
-0.93276006133987
<<Out>>
0.99695233289611
-0.93276006133987
<<Out>>
0.99695233289611
-0.93276006133987
<<Z>>
3.2425005248997
-1.6792184738059
Código example_fclayer_predict.cpp:
#include <Pds/Ra>
#include <Pds/Nn>
int main(void)
{
Pds::Vector In="1 4 1 2 -1";
Pds::Vector Out(2);
Pds::Vector Z(2);
Out.T().Print("\n<<Out>>\n");
Out.T().Print("\n<<Out>>\n");
Out.T().Print("\n<<Out>>\n");
Z.T().Print("<<Z>>\n");
Z.Apply(Pds::Sigmoid);
Z.T().Print("<<Z>>\n");
Pds::TensorBlock Block;
Block[0][0].Print("\n<<Block>>\n");
return 0;
}
La clase tipo Pds::FCLayer . Esta clase genera un objeto con dos parametros Nlin y Ncol....
const std::string FCLayer
Tag de un objeto de tipo Pds::FCLayer.
void PrintStylized(std::string str="") const
Muestra en pantalla el contenido de Pds::FCLayer, en el formato (Nli,Ncol).
Pds::TensorBlock PredictTensor(const Pds::TensorBlock &In) const
Evalua la capa de la CNN.
Pds::SampleBlock Predict(const Pds::SampleBlock &In) const
Evalua la capa de la CNN.