Home | Develop | Download | Contact
example_conv2dlayer_predict2.cpp

Programa para el testeo de las funciones Fully Connected Layer.Para compilar o código example_conv2dlayer_predict2.cpp:

g++ -static -o example_conv2dlayer_predict2 example_conv2dlayer_predict2.cpp -lpdsramm -lpdsnnmm

Para executar o programa:

./example_conv2dlayer_predict2

Retornando por consola:

Código example_conv2dlayer_predict2.cpp:

#include <Pds/Ra>
#include <Pds/Nn>
int main(void)
{
Pds::SampleBlock Out;
unsigned int L=5;
// Input file
Pds::SampleBlock In={Pds::RandN(5,5),Pds::RandN(5,5),Pds::RandN(5,5)};
In[0].Print("In[0]:\n");
In[1].Print("In[1]:\n");
In[2].Print("In[2]:\n");
std::cout<<"\n";
// Filtro Mean
Pds::Matrix Mean=Pds::Kernel2D::Mean(L)/3;
// Tensor con 2 filtros de 3 capas.
Pds::TensorBlock W={{Mean,Mean,Mean}};
Pds::Conv2DLayer Conv(W,Pds::Identity,Pds::DIdentity,{1, 1},Pds::Ra::Same);
Out=Conv.Predict(In);
Out[0].Print("Out[0]:\n");
Pds::TensorBlock Block=Conv.PredictTensor({In});
Block[0][0].Print("Block[0][0]:\n");
return 0;
}
La clase tipo Pds::Conv2DLayer . Esta clase genera un objeto con parametros. Para usar incluir <Pds/C...
Definition: Conv2DLayer.hpp:61
std::vector< Pds::Matrix > Predict(const std::vector< Pds::Matrix > &Input) const
Evalua la capa de la Conv2D.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed