LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 144 of file keras_model.h.

Constructor & Destructor Documentation

keras::LayerFlatten::LayerFlatten ( )
inline

Definition at line 146 of file keras_model.h.

146 : Layer("Flatten") {}
Layer(std::string name)
Definition: keras_model.h:133

Member Function Documentation

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

Implements keras::Layer.

Definition at line 128 of file keras_model.cc.

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

129 {
130  vector<vector<vector<float>>> im = dc->get_3d();
131 
132  size_t csize = im[0].size();
133  size_t rsize = im[0][0].size();
134  size_t size = im.size() * csize * rsize;
135  keras::DataChunkFlat* out = new DataChunkFlat(size);
136  float* y_ret = out->get_1d_rw().data();
137  for (size_t i = 0, dst = 0; i < im.size(); ++i) {
138  for (size_t j = 0; j < csize; ++j) {
139  float* row = im[i][j].data();
140  for (size_t k = 0; k < rsize; ++k) {
141  y_ret[dst++] = row[k];
142  }
143  }
144  }
145 
146  return out;
147 }
virtual std::vector< std::vector< std::vector< float > > > const & get_3d() const
Definition: keras_model.h:49
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
std::vector< float > & get_1d_rw()
Definition: keras_model.h:111
virtual unsigned int keras::LayerFlatten::get_input_cols ( ) const
inlinevirtual

Implements keras::Layer.

Definition at line 154 of file keras_model.h.

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

Implements keras::Layer.

Definition at line 150 of file keras_model.h.

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

Definition at line 140 of file keras_model.h.

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

Implements keras::Layer.

Definition at line 155 of file keras_model.h.

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

Implements keras::Layer.

Definition at line 147 of file keras_model.h.

147 {};

Member Data Documentation

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

Definition at line 141 of file keras_model.h.


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