TFCSGANLWTNNHandler class
#include <TFCSGANLWTNNHandler.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 class, TFCSONNXHandler, TFCSGANLWTNNHandler, TFCSSimpleLWTNNHandler.
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. This one handles the graph case, TFCSSimpleLWTNNHandler is for the non-graph case.
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
- TFCSGANLWTNNHandler(const std::string& inputFile) explicit
- TFCSGANLWTNNHandler constructor.
- TFCSGANLWTNNHandler(const TFCSGANLWTNNHandler& copy_from)
- TFCSGANLWTNNHandler 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
TFCSGANLWTNNHandler:: TFCSGANLWTNNHandler(const std::string& inputFile) explicit
TFCSGANLWTNNHandler 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.
TFCSGANLWTNNHandler:: TFCSGANLWTNNHandler(const TFCSGANLWTNNHandler& copy_from)
TFCSGANLWTNNHandler copy constructor.
| Parameters | |
|---|---|
| copy_from | existing network that we are copying |
Will copy the variables that would be generated by setupPersistedVariables and setupNet.
TFCSGANLWTNNHandler:: 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 TFCSGANLWTNNHandler:: 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> TFCSGANLWTNNHandler:: 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 TFCSGANLWTNNHandler:: 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.