8 #ifndef L1Trigger_L1TMuonOverlapPhase2_LutNetworkFixedPointRegression2Outputs_h 9 #define L1Trigger_L1TMuonOverlapPhase2_LutNetworkFixedPointRegression2Outputs_h 19 #include <boost/property_tree/ptree.hpp> 20 #include <boost/property_tree/xml_parser.hpp> 28 std::size_t inputSize,
53 std::cout <<
"LutNetworkFixedPoint" << std::endl;
106 std::array<ap_ufixed<layer2_input_I + layer2_input_F, layer2_input_I, AP_TRN, AP_SAT>,
layer1_neurons>
108 for (
unsigned int i = 0;
i < layer1Out.size();
i++) {
116 std::copy(layer2Out.begin(), layer2Out.begin() + lutLayer3_0_input.size(), lutLayer3_0_input.begin());
119 std::copy(layer2Out.begin() + lutLayer3_0_input.size(), layer2Out.end(), lutLayer3_1_input.begin());
125 void run(std::vector<float>&
inputs,
float noHitVal, std::vector<double>& nnResult)
override {
126 unsigned int noHitsCnt = 0;
127 for (
unsigned int iInput = 0; iInput <
inputs.size(); iInput++) {
129 if (
inputs[iInput] == noHitVal)
147 nnResult[0] = layer3_0_out.to_float();
148 nnResult[1] = layer3_1_out.to_float();
149 LogTrace(
"l1tOmtfEventPrint") <<
"layer3_0_out[0] " << layer3_0_out[0] <<
" layer3_1_out[0] " << layer3_1_out[0]
155 auto lutAddr = ap_ufixed<output0_I + output0_F + output0_F, output0_I + output0_F, AP_RND_CONV, AP_SAT>(
164 boost::property_tree::ptree
tree;
177 std::string key =
"LutNetworkFixedPointRegression2Outputs.ptCalibrationArray";
179 std::ostringstream ostr;
181 ostr <<
a.to_uint() <<
", ";
183 tree.put(
key +
".values", ostr.str());
188 boost::property_tree::xml_parser::xml_writer_make_settings<std::string>(
' ', 2));
193 boost::property_tree::ptree
tree;
207 std::string key =
"LutNetworkFixedPointRegression2Outputs.ptCalibrationArray";
213 std::stringstream
ss(
str);
217 if (std::getline(
ss,
item,
',')) {
218 a = std::stoul(
item,
nullptr, 10);
220 throw std::runtime_error(
221 "LutNetworkFixedPointRegression2Outputs::read: number of items get from file is smaller than lut size");
229 std::array<ap_ufixed<LutLayer1::input_W, input_I, AP_TRN, AP_SAT>, inputSize>
inputArray;
static constexpr int output1_F
std::array< ap_ufixed< input_W, input_I, AP_TRN, AP_SAT >, inputSize > inputArrayType
ap_uint< layer2_input_I > layer1Bias
#define PUT_VAR(tree, keyPath, var)
static constexpr int layer3_1_inputCnt
static constexpr unsigned int noHitCntShift
static constexpr int layer3_input_F
std::array< ap_ufixed< LutLayer1::input_W, input_I, AP_TRN, AP_SAT >, inputSize > inputArray
static constexpr int layer1_neurons
int getCalibratedHwPt() override
lutSumArrayType & runWithInterpolation(const inputArrayType &inputArray)
static constexpr int output1_I
LutNeuronLayerFixedPoint< layer2_input_I, layer2_input_F, layer1_neurons, layer2_lut_I, layer2_lut_F, layer2_neurons, layer3_input_I > LutLayer2
void setName(std::string name)
static constexpr int layer2_lut_I
static constexpr int layer1_lut_F
void save(const std::string &filename) override
auto & getOutWithOffset()
void load(boost::property_tree::ptree &tree, std::string keyPath)
static constexpr int layer3_0_lut_I
LutNeuronLayerFixedPoint< input_I, input_F, inputSize, layer1_lut_I, layer1_lut_F, layer1_neurons, layer1_output_I > LutLayer1
static constexpr int layer3_1_lut_I
void run(std::vector< float > &inputs, float noHitVal, std::vector< double > &nnResult) override
std::array< ap_uint< 9 >, 1<<(output0_I+output0_F)> ptCalibrationArray
auto & getPtCalibrationArray()
LutNeuronLayerFixedPoint< layer3_input_I, layer3_input_F, layer3_0_inputCnt, layer3_0_lut_I, layer3_0_lut_F, 1, output0_I > LutLayer3_0
key
prepare the HTCondor submission files and eventually submit them
def write_xml(scenario, fileName)
static constexpr int input_I
static constexpr int layer3_0_lut_F
static constexpr int layer1_output_I
void load(const std::string &filename) override
static constexpr int layer2_input_I
static constexpr int layer2_neurons
void runWithInterpolation()
static constexpr int layer2_input_F
LutNeuronLayerFixedPoint< layer3_input_I, layer3_input_F, layer3_1_inputCnt, layer3_1_lut_I, layer3_1_lut_F, 1, output1_I > LutLayer3_1
static constexpr int layer1_lut_I
static constexpr int input_F
static constexpr int layer3_input_I
void save(boost::property_tree::ptree &tree, std::string keyPath)
static constexpr int layer3_0_inputCnt
static constexpr int output0_I
#define CHECK_VAR(tree, keyPath, var)
static constexpr int layer2_lut_F
static constexpr int output0_F
LutNetworkFixedPointRegression2Outputs()
static constexpr int layer3_1_lut_F
~LutNetworkFixedPointRegression2Outputs() override