helayers::SimpleNeuralNet Class Reference
A simple neural network with a fixed architecture: 3 fully connected layers, each followed by a square activation layer. More...
#include <SimpleNeuralNet.h>
Public Member Functions | |
SimpleNeuralNet (HeContext &he) | |
Construct a network. More... | |
std::streamoff save (std::ostream &stream) const | |
Save network to binary stream. More... | |
std::streamoff load (std::istream &stream) | |
Load network from binary stream. More... | |
void initFromNet (const SimpleNeuralNetPlain &net, int baseChainIndex=-1) | |
Init network from a plain network. More... | |
void predict (const CipherMatrix &input, CipherMatrix &output) const | |
Run prediction. More... | |
Detailed Description
A simple neural network with a fixed architecture: 3 fully connected layers, each followed by a square activation layer.
It works on encrypted data: both inputs and weights, stored as CipherMatrix.
The encrypted weights of this network are either loaded from file, or encrypted from a SimpleNeuralNetPlain.
Constructor & Destructor Documentation
◆ SimpleNeuralNet()
helayers::SimpleNeuralNet::SimpleNeuralNet | ( | HeContext & | he | ) |
Construct a network.
- Parameters
-
[in] he the underlying context.
Member Function Documentation
◆ initFromNet()
void helayers::SimpleNeuralNet::initFromNet | ( | const SimpleNeuralNetPlain & | net, |
int | baseChainIndex = -1 |
||
) |
Init network from a plain network.
- Parameters
-
[in] net network to init from. [in] baseChainIndex first chain index to use (where applicable).
◆ load()
streamoff helayers::SimpleNeuralNet::load | ( | std::istream & | stream | ) |
Load network from binary stream.
- Parameters
-
[in] stream output stream to read from
◆ predict()
void helayers::SimpleNeuralNet::predict | ( | const CipherMatrix & | input, |
CipherMatrix & | output | ||
) | const |
Run prediction.
- Parameters
-
[in] input input data [out] output output prediction
◆ save()
streamoff helayers::SimpleNeuralNet::save | ( | std::ostream & | stream | ) | const |
Save network to binary stream.
- Parameters
-
[in] stream output stream to write to
The documentation for this class was generated from the following files:
- /opt/IBM/FHE-distro/ML-HElib/src/helayers/simple_nn/SimpleNeuralNet.h
- /opt/IBM/FHE-distro/ML-HElib/src/helayers/simple_nn/SimpleNeuralNet.cpp