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

#include "keras_model.h"

Inheritance diagram for keras::DataChunk2D:
keras::DataChunk

Public Member Functions

 DataChunk2D (size_t depth, size_t rows, size_t cols, float init)
 
 DataChunk2D (void)
 
std::vector< std::vector< std::vector< float > > > & get_3d_rw ()
 
std::vector< std::vector< std::vector< float > > > const & get_3d () const
 
virtual void set_data (std::vector< std::vector< std::vector< float > > > const &d)
 
size_t get_data_dim (void) const
 
void show_name ()
 
void show_values ()
 
void read_from_file (const std::string &fname)
 
virtual std::vector< float > const & get_1d () const
 
virtual void set_data (std::vector< float > const &)
 

Public Attributes

std::vector< std::vector< std::vector< float > > > data
 
int m_depth
 
int m_rows
 
int m_cols
 

Detailed Description

Definition at line 55 of file keras_model.h.

Constructor & Destructor Documentation

keras::DataChunk2D::DataChunk2D ( size_t  depth,
size_t  rows,
size_t  cols,
float  init 
)
inline

Definition at line 57 of file keras_model.h.

57  :
58  data(depth, std::vector< std::vector<float> >(rows, std::vector<float>(cols, init)))
59  { }
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:88
keras::DataChunk2D::DataChunk2D ( void  )
inline

Definition at line 60 of file keras_model.h.

60 { }

Member Function Documentation

virtual std::vector<float> const& keras::DataChunk::get_1d ( ) const
inlinevirtualinherited

Reimplemented in keras::DataChunkFlat.

Definition at line 45 of file keras_model.h.

Referenced by keras::LayerActivation::compute_output(), keras::LayerDense::compute_output(), and keras::KerasModel::compute_output().

45 { throw "not implemented"; };
std::vector< std::vector< std::vector<float> > > const& keras::DataChunk2D::get_3d ( ) const
inlinevirtual

Reimplemented from keras::DataChunk.

Definition at line 63 of file keras_model.h.

63 { return data; };
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:88
std::vector< std::vector< std::vector<float> > >& keras::DataChunk2D::get_3d_rw ( )
inline

Definition at line 62 of file keras_model.h.

Referenced by keras::LayerConv2D::compute_output().

62 { return data; };
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:88
size_t keras::DataChunk2D::get_data_dim ( void  ) const
inlinevirtual

Reimplemented from keras::DataChunk.

Definition at line 65 of file keras_model.h.

65 { return 3; }
void keras::DataChunk2D::read_from_file ( const std::string &  fname)
virtual

Reimplemented from keras::DataChunk.

Definition at line 27 of file keras_model.cc.

References d, fin, and keras::read_1d_array().

27  {
28  ifstream fin(fname.c_str());
29  fin >> m_depth >> m_rows >> m_cols;
30 
31  for(int d = 0; d < m_depth; ++d) {
32  vector<vector<float> > tmp_single_depth;
33  for(int r = 0; r < m_rows; ++r) {
34  vector<float> tmp_row = keras::read_1d_array(fin, m_cols);
35  tmp_single_depth.push_back(tmp_row);
36  }
37  data.push_back(tmp_single_depth);
38  }
39  fin.close();
40 }
TString fin
Definition: Style.C:24
Float_t d
Definition: plot.C:237
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:88
std::vector< float > read_1d_array(std::ifstream &fin, int cols)
Definition: keras_model.cc:14
virtual void keras::DataChunk::set_data ( std::vector< float > const &  )
inlinevirtualinherited

Reimplemented in keras::DataChunkFlat.

Definition at line 48 of file keras_model.h.

48 {};
virtual void keras::DataChunk2D::set_data ( std::vector< std::vector< std::vector< float > > > const &  d)
inlinevirtual

Reimplemented from keras::DataChunk.

Definition at line 64 of file keras_model.h.

References d.

64 { data = d; };
Float_t d
Definition: plot.C:237
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:88
void keras::DataChunk2D::show_name ( )
inlinevirtual

Implements keras::DataChunk.

Definition at line 67 of file keras_model.h.

67  {
68  std::cout << "DataChunk2D " << data.size() << "x" << data[0].size() << "x" << data[0][0].size() << std::endl;
69  }
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:88
void keras::DataChunk2D::show_values ( )
inlinevirtual

Implements keras::DataChunk.

Definition at line 71 of file keras_model.h.

References keras::DataChunk::read_from_file().

71  {
72  std::cout << "DataChunk2D values:" << std::endl;
73  for(size_t i = 0; i < data.size(); ++i) {
74  std::cout << "Kernel " << i << std::endl;
75  for(size_t j = 0; j < data[0].size(); ++j) {
76  for(size_t k = 0; k < data[0][0].size(); ++k) {
77  std::cout << data[i][j][k] << " ";
78  }
79  std::cout << std::endl;
80  }
81  }
82  }
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:88

Member Data Documentation

std::vector<std::vector<std::vector<float> > > keras::DataChunk2D::data

Definition at line 88 of file keras_model.h.

int keras::DataChunk2D::m_cols

Definition at line 92 of file keras_model.h.

int keras::DataChunk2D::m_depth

Definition at line 90 of file keras_model.h.

int keras::DataChunk2D::m_rows

Definition at line 91 of file keras_model.h.


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