TFCSNetworkFactory class
#include <TFCSNetworkFactory.h>
Contents
- Reference
Class to perform runtime selection from the derived classes of VNetworkBase given input for a network.
Has only static functions because no statelike information is needed to make this decision.
Information about the which network would be apropreate can be specified, or left entirely to the factory to determine.
Public static functions
- static auto create(std::string input) -> std::unique_ptr<VNetworkBase>
- Given a string, make a network.
- static auto create(std::string input, bool graph_form) -> std::unique_ptr<VNetworkBase>
- Given a string, and information about format, make a network.
- static auto create(std::vector<char> const& input) -> std::unique_ptr<VNetworkBase>
- Given a vector of chars (bytes), make a network.
- static auto create(std::vector<char> const& vector_input, std::string string_input) -> std::unique_ptr<VNetworkBase>
- Create a network from whichever input isn't empty.
- static auto create(std::vector<char> const& vector_input, std::string string_input, bool graph_form) -> std::unique_ptr<VNetworkBase>
- Create a network from whichever input isn't empty.
Function documentation
static std::unique_ptr<VNetworkBase> TFCSNetworkFactory:: create(std::string input)
Given a string, make a network.
| Parameters | |
|---|---|
| input | Either a file path, or the content of a file. |
This function will first check if the string is the path of a readable file on the disk. If so, the file suffix is used to decide if it's an onnx (.onnx) or lwtnn file (.json). If the filepath ends in .* then first an onnx then an lwtnn file will be tried. The file is read and parsed into a network.
If the string is not a filepath, it is assumed to be the content of a json file to make an lwtnn network.
When an lwtnn network is created, first the TFCSSimpleLWTNNHandler format is tried, and if this raises an error, the TFCSGANLWTNNHandler is applied. The former is simpler than the latter, so it will always fail to parse the more complex graph format.
static std::unique_ptr<VNetworkBase> TFCSNetworkFactory:: create(std::string input,
bool graph_form)
Given a string, and information about format, make a network.
| Parameters | |
|---|---|
| input | Either a file path, or the content of a file. |
| graph_form | Is the network the more complex graph form? |
This function will first check if the string is the path of a readable file on the disk. If so, the file suffix is used to decide if it's an onnx (.onnx) or lwtnn file (.json). If the filepath ends in .* then first an onnx then an lwtnn file will be tried. The file is read and parsed into a network.
If the string is not a filepath, it is assumed to be the content of a json file to make an lwtnn network.
When an lwtnn network is created, if graph_form is true the network will be a TFCSSimpleLWTNNHandler otherwise it is a TFCSGANLWTNNHandler.
static std::unique_ptr<VNetworkBase> TFCSNetworkFactory:: create(std::vector<char> const& input)
Given a vector of chars (bytes), make a network.
| Parameters | |
|---|---|
| input | The content of an onnx proto file. |
This function will always create a TFCSONNXHandler. Caution: this function is designed to modify its input.
static std::unique_ptr<VNetworkBase> TFCSNetworkFactory:: create(std::vector<char> const& vector_input,
std::string string_input)
Create a network from whichever input isn't empty.
| Parameters | |
|---|---|
| vector_input | The content of an onnx proto file. |
| string_input | Either a file path, or the content of a file. |
If the vector_input is not empty, construct a network from that, otherwise, use the string_input to construct a network.
static std::unique_ptr<VNetworkBase> TFCSNetworkFactory:: create(std::vector<char> const& vector_input,
std::string string_input,
bool graph_form)
Create a network from whichever input isn't empty.
| Parameters | |
|---|---|
| vector_input | The content of an onnx proto file. |
| string_input | Either a file path, or the content of a file. |
| graph_form | Is the network the more complex graph form? |
If the vector_input is not empty, construct a network from that, otherwise, use the string_input to construct a network. Whether the network is in graph form is specified for LWTNN networks.