TFCSSimpleLWTNNHandler class
#include <TFCSSimpleLWTNNHandler.h>
Contents
Class for a neural network read in the LWTNN format. Derived from the abstract base class VNetworkBase such that it can be used interchangeably with it's sibling classes, TFCSSimpleLWTNNHandler, TFCSGANLWTNNHandler, TFCSONNXHandler.
Frustratingly, LightweightNeuralNetwork and LightweightGraph from lwtnn do not have a common ancestor, they could be connected with the bridge pattern, but that is more complex that currently required.
The LoadNetwork function has VNetworkBase as it's return type so that it can make a run-time decision about which derived class to use, based on the file name presented.
Base classes
- class VNetworkLWTNN
- A template defining the interface to a lwtnn network.
Constructors, destructors, conversion operators
- TFCSSimpleLWTNNHandler(const std::string& inputFile) explicit
- TFCSSimpleLWTNNHandler constructor.
- TFCSSimpleLWTNNHandler(const TFCSSimpleLWTNNHandler& copy_from)
- TFCSSimpleLWTNNHandler copy constructor.
- VNetworkLWTNN()
- VNetworkLWTNN copy constructor.
Public functions
- auto compute(NetworkInputs const& inputs) const -> NetworkOutputs override
- Function to pass values to the network.
- auto getOutputLayers() const -> std::vector<std::string> override
- List the names of the outputs.
Protected functions
- void setupNet() override
- Perform actions that prepare network for use.
Function documentation
TFCSSimpleLWTNNHandler:: TFCSSimpleLWTNNHandler(const std::string& inputFile) explicit
TFCSSimpleLWTNNHandler constructor.
| Parameters | |
|---|---|
| inputFile | file-path on disk (with file name) of a readable lwtnn file containing a json format description of the network to be constructed, or the json itself as a string. |
Calls setupPersistedVariables and setupNet.
TFCSSimpleLWTNNHandler:: TFCSSimpleLWTNNHandler(const TFCSSimpleLWTNNHandler& copy_from)
TFCSSimpleLWTNNHandler copy constructor.
| Parameters | |
|---|---|
| copy_from | existing network that we are copying |
Will copy the variables that would be generated by setupPersistedVariables and setupNet.
TFCSSimpleLWTNNHandler:: VNetworkLWTNN()
VNetworkLWTNN copy constructor.
Will copy the variables that would be generated by setupPersistedVariables and setupNet. Will fail if deleteAllButNet has already been called.
NetworkOutputs TFCSSimpleLWTNNHandler:: compute(NetworkInputs const& inputs) const override
Function to pass values to the network.
| Parameters | |
|---|---|
| inputs | values to be evaluated by the network |
| Returns | the output of the network |
This function, hides variations in the formatted needed by different network libraries, providing a uniform input and output type.
std::vector<std::string> TFCSSimpleLWTNNHandler:: getOutputLayers() const override
List the names of the outputs.
Outputs are stored in an NetworkOutputs object which is indexed by strings. This function returns the list of all strings that will index the outputs.
void TFCSSimpleLWTNNHandler:: setupNet() override protected
Perform actions that prepare network for use.
Will be called in the streamer or class constructor after the inputs have been set (either automaically by the streamer or by setupPersistedVariables in the constructor). Does not delete any resources used.