Home | Develop | Download | Contact
example_conv2dlayer_export.cpp

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

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

Para executar o programa:

./example_conv2dlayer_export

Retornando por consola:

Código example_conv2dlayer_export.cpp:

#include <Pds/Ra>
#include <Pds/Nn>
int main(void)
{
unsigned int Nout=2;
unsigned int Nin=2;
// Tensor with Nout filters of Nin channels of size 3x3.
Pds::TensorBlock W=Pds::Matrix::RandNTensorBlock(Nout,Nin,Pds::Size(3,3));
// Creating a convolutional 2D Layer
Pds::Conv2DLayer Conv(W,Pds::Identity,Pds::DIdentity,{1, 1},Pds::Ra::Same);
// Saving the convolutional layer.
std::ofstream myfile("Conv2DLayer.txt", std::ofstream::out);
if (myfile.is_open())
{
Conv.SaveInStream(myfile);
myfile.close();
}
// Loading the convolutional layer.
std::ifstream ifs("Conv2DLayer.txt");
if (ifs.is_open())
{
Conv2.LoadFromStream(ifs);
ifs.close();
}
Conv2.PrintStylized("Conv:\n");
return 0;
}
La clase tipo Pds::Conv2DLayer . Esta clase genera un objeto con parametros. Para usar incluir <Pds/C...
Definition: Conv2DLayer.hpp:61
void PrintStylized(std::string str="") const
Muestra en pantalla el contenido de Pds::Conv2DLayer, en el formato (Nli,Ncol).
bool LoadFromStream(std::ifstream &ifs)
Carga los datos de la capa.
double(* DefaultDActFunc)(double)
double(* DefaultActFunc)(double)

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed