ATLAS Offline Software
|
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration. More...
#include <TFCSNetworkFactory.h>
Static Public Member Functions | |
static std::unique_ptr< VNetworkBase > | create (std::string input) |
Given a string, make a network. More... | |
static std::unique_ptr< VNetworkBase > | create (std::string input, bool graph_form) |
Given a string, and information about format, make a network. More... | |
static std::unique_ptr< VNetworkBase > | create (std::vector< char > const &input) |
Given a vector of chars (bytes), make a network. More... | |
static std::unique_ptr< VNetworkBase > | create (std::vector< char > const &vector_input, std::string string_input) |
Create a network from whichever input isn't empty. More... | |
static std::unique_ptr< VNetworkBase > | create (std::vector< char > const &vector_input, std::string string_input, bool graph_form) |
Create a network from whichever input isn't empty. More... | |
Static Private Member Functions | |
static void | resolveGlobs (std::string &filename) |
If the filepath ends in . More... | |
static bool | isOnnxFile (std::string const &filename) |
Check if a filename seems to be an onnx file. More... | |
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
Class to perform runtime selection from the derived classes of VNetworkBase given inout for a network.
Has only static functions becuase 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.
Definition at line 24 of file TFCSNetworkFactory.h.
|
static |
Given a string, make a network.
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.
input | Either a file path, or the content of a file. |
Definition at line 66 of file TFCSNetworkFactory.cxx.
|
static |
Given a string, and information about format, make a network.
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.
input | Either a file path, or the content of a file. |
graph_form | Is the network the more complex graph form? |
Definition at line 90 of file TFCSNetworkFactory.cxx.
|
static |
Given a vector of chars (bytes), make a network.
This function will always create a TFCSONNXHandler. Caution: this function is designed to modify its input.
input | The content of an onnx proto file. |
Definition at line 58 of file TFCSNetworkFactory.cxx.
|
static |
Create a network from whichever input isn't empty.
If the vector_input is not empty, construct a network from that, otherwise, use the string_input to construct a network.
vector_input | The content of an onnx proto file. |
string_input | Either a file path, or the content of a file. |
Definition at line 111 of file TFCSNetworkFactory.cxx.
|
static |
Create a network from whichever input isn't empty.
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 specifed for LWTNN networks.
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 compelx graph form? |
Definition at line 132 of file TFCSNetworkFactory.cxx.
|
staticprivate |
Check if a filename seems to be an onnx file.
Really just checks if the input ends in ".onnx"
filename | Path to check. |
Definition at line 42 of file TFCSNetworkFactory.cxx.
|
staticprivate |
If the filepath ends in .
If the filepath doesn't end in .*, no change is made. Will check first for a .onnx file, then look for a .json. Throws an exception if niether are found.
filename | Path to check. |
Definition at line 19 of file TFCSNetworkFactory.cxx.