LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
keras::LayerFlatten Class Reference

#include "keras_model.h"

Inheritance diagram for keras::LayerFlatten:
keras::Layer

Public Member Functions

 LayerFlatten ()
 
void load_weights (std::ifstream &fin)
 
keras::DataChunkcompute_output (keras::DataChunk *)
 
virtual unsigned int get_input_rows () const
 
virtual unsigned int get_input_cols () const
 
virtual unsigned int get_output_units () const
 
std::string get_name ()
 

Public Attributes

std::string m_name
 

Detailed Description

Definition at line 136 of file keras_model.h.

Constructor & Destructor Documentation

keras::LayerFlatten::LayerFlatten ( )
inline

Definition at line 138 of file keras_model.h.

138 : Layer("Flatten") {}
Layer(std::string name)
Definition: keras_model.h:124

Member Function Documentation

keras::DataChunk * keras::LayerFlatten::compute_output ( keras::DataChunk dc)
virtual

Implements keras::Layer.

Definition at line 124 of file keras_model.cc.

References keras::DataChunkFlat::get_1d_rw(), and keras::DataChunk::get_3d().

124  {
125  vector<vector<vector<float> > > im = dc->get_3d();
126 
127  size_t csize = im[0].size();
128  size_t rsize = im[0][0].size();
129  size_t size = im.size() * csize * rsize;
130  keras::DataChunkFlat *out = new DataChunkFlat(size);
131  float * y_ret = out->get_1d_rw().data();
132  for(size_t i = 0, dst = 0; i < im.size(); ++i) {
133  for(size_t j = 0; j < csize; ++j) {
134  float * row = im[i][j].data();
135  for(size_t k = 0; k < rsize; ++k) {
136  y_ret[dst++] = row[k];
137  }
138  }
139  }
140 
141  return out;
142 }
virtual std::vector< std::vector< std::vector< float > > > const & get_3d() const
Definition: keras_model.h:46
std::vector< float > & get_1d_rw()
Definition: keras_model.h:102
virtual unsigned int keras::LayerFlatten::get_input_cols ( ) const
inlinevirtual

Implements keras::Layer.

Definition at line 143 of file keras_model.h.

143 { return 0; } // same as for rows
virtual unsigned int keras::LayerFlatten::get_input_rows ( ) const
inlinevirtual

Implements keras::Layer.

Definition at line 142 of file keras_model.h.

142 { return 0; } // look for the value in the preceding layer
std::string keras::Layer::get_name ( )
inlineinherited

Definition at line 131 of file keras_model.h.

131 { return m_name; }
std::string m_name
Definition: keras_model.h:132
virtual unsigned int keras::LayerFlatten::get_output_units ( ) const
inlinevirtual

Implements keras::Layer.

Definition at line 144 of file keras_model.h.

144 { return 0; }
void keras::LayerFlatten::load_weights ( std::ifstream &  fin)
inlinevirtual

Implements keras::Layer.

Definition at line 139 of file keras_model.h.

139 {};

Member Data Documentation

std::string keras::Layer::m_name
inherited

Definition at line 132 of file keras_model.h.


The documentation for this class was generated from the following files: