12#include "lwtnn/LightweightNeuralNetwork.hh"
13#include "lwtnn/parse_json.hh"
27 ATH_MSG_DEBUG(
"Making new m_lwtnn_neural for copy of network.");
28 std::stringstream json_stream(
m_json);
29 const lwt::JSONConfig
config = lwt::parse_json(json_stream);
37 ATH_MSG_DEBUG(
"Reading the m_json string stream into a neural network");
38 std::stringstream json_stream(
m_json);
39 const lwt::JSONConfig
config = lwt::parse_json(json_stream);
44 for (
const std::string& name :
config.outputs) {
64 if (inputs.size() != 1) {
66 <<
" An LWTNN neural network can only handle one node.");
68 std::map<std::string, double> flat_inputs;
69 for (
const auto &
node : inputs) {
70 flat_inputs =
node.second;
76 ATH_MSG_DEBUG(
"Computation on LWTNN neural network done, returning");
81void TFCSSimpleLWTNNHandler::Streamer(TBuffer &buf) {
83 if (buf.IsReading()) {
86 TFCSSimpleLWTNNHandler::Class()->ReadBuffer(buf,
this);
90#ifndef __FastCaloSimStandAlone__
100 "Writing buffer in TFCSSimpleLWTNNHandler, but m_json is empty.");
103 TFCSSimpleLWTNNHandler::Class()->WriteBuffer(buf,
this);
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::vector< std::string > m_outputLayers
Do not persistify.
NetworkOutputs compute(NetworkInputs const &inputs) const override
Function to pass values to the network.
void setupNet() override
Perform actions that prepare network for use.
std::unique_ptr< lwt::LightweightNeuralNetwork > m_lwtnn_neural
The network that we are wrapping here.
VNetworkLWTNN(const VNetworkLWTNN ©_from)
VNetworkLWTNN copy constructor.
std::vector< std::string > getOutputLayers() const override
List the names of the outputs.
TFCSSimpleLWTNNHandler(const std::string &inputFile)
TFCSSimpleLWTNNHandler constructor.
std::map< std::string, std::map< std::string, double > > NetworkInputs
Format for network inputs.
static std::string representNetworkOutputs(NetworkOutputs const &outputs, int maxValues=3)
String representation of network outputs.
std::map< std::string, double > NetworkOutputs
Format for network outputs.
void removePrefixes(NetworkOutputs &outputs) const
Remove any common prefix from the outputs.
static std::string representNetworkInputs(NetworkInputs const &inputs, int maxValues=3)
String representation of network inputs.
void deleteAllButNet() override
Get rid of any memory objects that arn't needed to run the net.
std::string m_json
String containing json input file.
void setupPersistedVariables() override
Perform actions that prep data to create the net.