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

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

Definition at line 66 of file keras_model.h.

66 {}

Member Function Documentation

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

Reimplemented in keras::DataChunkFlat.

Definition at line 48 of file keras_model.h.

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

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

Reimplemented from keras::DataChunk.

Definition at line 69 of file keras_model.h.

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

Definition at line 68 of file keras_model.h.

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

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

Reimplemented from keras::DataChunk.

Definition at line 71 of file keras_model.h.

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

Reimplemented from keras::DataChunk.

Definition at line 24 of file keras_model.cc.

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

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

Reimplemented in keras::DataChunkFlat.

Definition at line 54 of file keras_model.h.

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

Reimplemented from keras::DataChunk.

Definition at line 70 of file keras_model.h.

References d.

Referenced by PointIdAlgTools::PointIdAlgKeras::Run().

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

Implements keras::DataChunk.

Definition at line 73 of file keras_model.h.

74  {
75  std::cout << "DataChunk2D " << data.size() << "x" << data[0].size() << "x" << data[0][0].size()
76  << std::endl;
77  }
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:97
void keras::DataChunk2D::show_values ( )
inlinevirtual

Implements keras::DataChunk.

Definition at line 79 of file keras_model.h.

References keras::DataChunk::read_from_file().

80  {
81  std::cout << "DataChunk2D values:" << std::endl;
82  for (size_t i = 0; i < data.size(); ++i) {
83  std::cout << "Kernel " << i << std::endl;
84  for (size_t j = 0; j < data[0].size(); ++j) {
85  for (size_t k = 0; k < data[0][0].size(); ++k) {
86  std::cout << data[i][j][k] << " ";
87  }
88  std::cout << std::endl;
89  }
90  }
91  }
std::vector< std::vector< std::vector< float > > > data
Definition: keras_model.h:97

Member Data Documentation

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

Definition at line 97 of file keras_model.h.

int keras::DataChunk2D::m_cols

Definition at line 101 of file keras_model.h.

int keras::DataChunk2D::m_depth

Definition at line 99 of file keras_model.h.

int keras::DataChunk2D::m_rows

Definition at line 100 of file keras_model.h.


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