Home | Develop | Download | Contact
example_fclayer_predict.cpp

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);
Pds::FCLayer Layer=Pds::FCLayer(5,2,Pds::Tanh,Pds::DTanh);
Layer.PrintStylized("<<Layer>>:\n");
Out=Layer.Predict(In);
Out.T().Print("\n<<Out>>\n");
Layer.Predict(In,Out);
Out.T().Print("\n<<Out>>\n");
Layer.Predict(In,Out,Z);
Out.T().Print("\n<<Out>>\n");
Z.T().Print("<<Z>>\n");
Z.Apply(Pds::Sigmoid);
Z.T().Print("<<Z>>\n");
Pds::TensorBlock Block;
Block=Layer.PredictTensor({{In.T()}});
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....
Definition: FCLayer.hpp:61
const std::string FCLayer
Tag de un objeto de tipo Pds::FCLayer.
Definition: NnDefines.hpp:149
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.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed