ATLAS Offline Software
Functions
EvaluateUtils Namespace Reference

Functions

std::vector< std::vector< std::vector< float > > > read_mnist_pixel_notFlat (const std::string &full_path)
 

Function Documentation

◆ read_mnist_pixel_notFlat()

std::vector< std::vector< std::vector< float > > > EvaluateUtils::read_mnist_pixel_notFlat ( const std::string &  full_path)

Definition at line 11 of file EvaluateUtils.cxx.

12  {
13  std::vector<std::vector<std::vector<float>>> input_tensor_values;
14  input_tensor_values.resize(10000, std::vector<std::vector<float> >(28,std::vector<float>(28)));
15  std::ifstream file (full_path.c_str(), std::ios::binary);
16  int magic_number=0;
17  int number_of_images=0;
18  int n_rows=0;
19  int n_cols=0;
20  file.read((char*)&magic_number,sizeof(magic_number));
21  magic_number= ntohl(magic_number);
22  file.read((char*)&number_of_images,sizeof(number_of_images));
23  number_of_images= ntohl(number_of_images);
24  file.read((char*)&n_rows,sizeof(n_rows));
25  n_rows= ntohl(n_rows);
26  file.read((char*)&n_cols,sizeof(n_cols));
27  n_cols= ntohl(n_cols);
28  for(int i=0;i<number_of_images;++i)
29  {
30  for(int r=0;r<n_rows;++r)
31  {
32  for(int c=0;c<n_cols;++c)
33  {
34  unsigned char temp=0;
35  file.read((char*)&temp,sizeof(temp));
36  input_tensor_values[i][r][c]= float(temp)/255;
37  }
38  }
39  }
40  return input_tensor_values;
41  }
beamspotman.r
def r
Definition: beamspotman.py:676
lumiFormat.i
int i
Definition: lumiFormat.py:85
file
TFile * file
Definition: tile_monitor.h:29
python.compressB64.c
def c
Definition: compressB64.py:93
readCCLHist.float
float
Definition: readCCLHist.py:83