Search Results

A simple utility class for loading data from h5 files. More...

#include <h5Parser.h>

Public Member Functions

 H5Parser (std::string f)
Constructor. More...
 
void readData (const std::string &path, double &val) const
Reads the scalar from the given path into "val". More...
 
void readData (const std::string &path, std::vector< double > &vals, std::vector< int > &dims) const
Reads the (flattened) tensor from the given path into "vals" , and stores its original dimensions in "dims". More...
 
void readData (const std::string &path, boost::numeric::ublas::tensor< double > &vals) const
Reads the tensor from the given path into "vals". More...
 
std::vector< double > parseBias (std::string path) const
Loads fully-connected layer bias from a given path inside file.
 
std::vector< std::vector< double > > parseFC (std::string path) const
Loads fully-connected layer weights from a given path inside file.
 
std::vector< std::vector< std::vector< double > > > parseFilters (std::string path) const
Loads convolution layer filters from a given path inside file.
 
bool objectExists (const std::string &name) const
Checks if given name exists in file.
 
H5::H5File & getFile ()
Returns underlying H5File object.
 

Protected Attributes

std::string file_name
 
H5::H5File file
 

Detailed Description

A simple utility class for loading data from h5 files.

Constructor & Destructor Documentation

◆ H5Parser()

helayers::H5Parser::H5Parser ( std::string  f)

Constructor.

Parameters
[in]ffile to read

Member Function Documentation

◆ readData() [1/3]

void helayers::H5Parser::readData ( const std::string &  path,
boost::numeric::ublas::tensor< double > &  vals 
) const

Reads the tensor from the given path into "vals".

Parameters
[in]pathThe path to read from
[out]valsThis tensor will contain the tensor read from the given path.

◆ readData() [2/3]

void helayers::H5Parser::readData ( const std::string &  path,
double &  val 
) const

Reads the scalar from the given path into "val".

Parameters
[in]pathThe path to read from.
[out]valThis will contain the read value.
Exceptions
invalid_arguementif the given path contain a non-scalar tensor.

◆ readData() [3/3]

void helayers::H5Parser::readData ( const std::string &  path,
std::vector< double > &  vals,
std::vector< int > &  dims 
) const

Reads the (flattened) tensor from the given path into "vals" , and stores its original dimensions in "dims".

Parameters
[in]pathThe path to read from.
[out]valsThis vector will contain The tensor read from the given path, flattened into 1D vector.
[out]dimsThe original dimensions of the tensor in the given path.

The documentation for this class was generated from the following files:
  • /opt/IBM/FHE-distro/ML-HElib/src/helayers/simple_nn/h5Parser.h
  • /opt/IBM/FHE-distro/ML-HElib/src/helayers/simple_nn/h5Parser.cpp