Classes | Functions
keras Namespace Reference

Classes

class  DataChunk
 
class  DataChunk2D
 
class  DataChunkFlat
 
class  KerasModel
 
class  Layer
 
class  LayerActivation
 
class  LayerConv2D
 
class  LayerDense
 
class  LayerFlatten
 
class  LayerMaxPooling
 

Functions

std::vector< float > read_1d_array (std::ifstream &fin, int cols)
 
void missing_activation_impl (const std::string &act)
 
std::vector< std::vector< float > > conv_single_depth_valid (std::vector< std::vector< float > > const &im, std::vector< std::vector< float > > const &k)
 
std::vector< std::vector< float > > conv_single_depth_same (std::vector< std::vector< float > > const &im, std::vector< std::vector< float > > const &k)
 

Function Documentation

std::vector< std::vector< float > > keras::conv_single_depth_same ( std::vector< std::vector< float > > const &  im,
std::vector< std::vector< float > > const &  k 
)

Definition at line 250 of file KerasModel.cxx.

References MECModelEnuComparisons::i, calib::j, gen_flatrecord::size, and submit_syst::y.

Referenced by keras::LayerConv2D::compute_output(), and missing_activation_impl().

253 {
254  unsigned int st_x = (k.size() - 1) / 2;
255  unsigned int st_y = (k[0].size() - 1) / 2;
256 
257  std::vector< std::vector<float> > y;
258  for(unsigned int i = 0; i < im.size(); ++i) {
259  y.emplace_back(vector<float>(im[0].size(), 0.0));
260  }
261  for(unsigned int i = 0; i < im.size(); ++i) {
262  for(unsigned int j = 0; j < im[0].size(); ++j) {
263  for(unsigned int k1 = 0; k1 < k.size(); ++k1) {
264  for(unsigned int k2 = 0; k2 < k[0].size(); ++k2) {
265  if(i+k1 < st_x) continue;
266  if(i-st_x+k1 > im.size()-1) continue;
267  if(j+k2 < st_y) continue;
268  if(j-st_y+k2 > im[0].size()-1) continue;
269  y[i][j] += k[k.size()-k1-1][k[0].size()-k2-1] * im[i-st_x+k1][j-st_y+k2];
270  }
271  }
272  }
273  }
274  return y;
275 }
const double j
Definition: BetheBloch.cxx:29
std::vector< std::vector< float > > keras::conv_single_depth_valid ( std::vector< std::vector< float > > const &  im,
std::vector< std::vector< float > > const &  k 
)

Definition at line 225 of file KerasModel.cxx.

References MECModelEnuComparisons::i, calib::j, gen_flatrecord::size, and submit_syst::y.

Referenced by keras::LayerConv2D::compute_output(), and missing_activation_impl().

228 {
229  unsigned int st_x = (k.size() - 1) >> 1;
230  unsigned int st_y = (k[0].size() - 1) >> 1;
231 
232  std::vector< std::vector<float> > y;
233  for(unsigned int i = 0; i < im.size()-2*st_x; ++i) {
234  y.emplace_back(vector<float>(im[0].size()-2*st_y, 0.0));
235  }
236  for(unsigned int i = st_x; i < im.size()-st_x; ++i) {
237  for(unsigned int j = st_y; j < im[0].size()-st_y; ++j) {
238  for(unsigned int k1 = 0; k1 < k.size(); ++k1) {
239  for(unsigned int k2 = 0; k2 < k[0].size(); ++k2) {
240  y[i-st_x][j-st_y] += k[k.size()-k1-1][k[0].size()-k2-1] * im[i-st_x+k1][j-st_y+k2];
241  }
242  }
243  }
244  }
245  return y;
246 }
const double j
Definition: BetheBloch.cxx:29
void keras::missing_activation_impl ( const std::string &  act)
std::vector< float > keras::read_1d_array ( std::ifstream &  fin,
int  cols 
)

Definition at line 11 of file KerasModel.cxx.

References cols, and getGoodRuns4SAM::n.

Referenced by keras::DataChunk2D::read_from_file().

11  {
12  vector<float> arr;
13  float tmp_float;
14  char tmp_char;
15  fin >> tmp_char; // for '['
16  for(int n = 0; n < cols; ++n) {
17  fin >> tmp_float;
18  arr.push_back(tmp_float);
19  }
20  fin >> tmp_char; // for ']'
21  return arr;
22 }
TString fin
Definition: Style.C:24
const int cols[3]