Home | Develop | Download | Contact
example_conv2dlayer_export_xml.cpp
1 
21 #include <Pds/Ra>
22 #include <Pds/Nn>
23 
24 int main(void)
25 {
26  unsigned int Nout=2;
27  unsigned int Nin=2;
28 
29  // Tensor with Nout filters of Nin channels of size 3x3.
30  Pds::TensorBlock W=Pds::Matrix::RandNTensorBlock(Nout,Nin,Pds::Size(1,3));
31 
32  // Creating a convolutional 2D Layer
33  Pds::Conv2DLayer Conv(W,Pds::Identity,Pds::DIdentity,{1, 1},Pds::Ra::Same);
34 
35  // Saving the convolutional layer.
36  std::string str=Conv.ExportXmlToString();
37  std::cout<<str<<"\n";
38 
39  std::ofstream myfile("Conv2DLayer1.xml", std::ofstream::out);
40  Conv.ExportXmlToStream(myfile);
41  myfile.close();
42 
43 
44  // Loading the convolutional layer.
45  Pds::Conv2DLayer Conv2;
46  Conv2.ImportXmlFromString(str);
47  Conv2.PrintStylized("Conv:\n");
48 
49  return 0;
50 }
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 ImportXmlFromString(const std::string &str)
Carga los datos de la capa.
std::string ExportXmlToString(void) const
Salva los datos de la capa en un std::string en formato Xml.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed