Skip to content

Commit

Permalink
remove using catch()
Browse files Browse the repository at this point in the history
  • Loading branch information
lwang046 committed Jul 19, 2023
1 parent cf91e75 commit 51edc95
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions DQM/HcalTasks/plugins/OnlineDQMDigiAD_cmssw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,15 @@ OnlineDQMDigiAD::OnlineDQMDigiAD(const std::string model_system_name,
}

void OnlineDQMDigiAD::IsModelExist(std::string hcal_subsystem_name) {
assert(std::find(hcal_modeled_systems.begin(), hcal_modeled_systems.end(), hcal_subsystem_name) !=
hcal_modeled_systems.end());

//std::cout << "onnx model integration is supported for the selected " << hcal_subsystem_name << " system!" << std::endl;
// assert(std::find(hcal_modeled_systems.begin(), hcal_modeled_systems.end(), hcal_subsystem_name) !=
// hcal_modeled_systems.end());
// std::cout << "onnx model integration is supported for the selected " << hcal_subsystem_name << " system!" << std::endl;
if (std::find(hcal_modeled_systems.begin(), hcal_modeled_systems.end(), hcal_subsystem_name) ==
hcal_modeled_systems.end()) {
std::string err =
"ML for OnlineDQM is not currently supported for the selected " + hcal_subsystem_name + " system!\n";
throw std::invalid_argument(err);
}
}

void OnlineDQMDigiAD::InitializeState() {
Expand Down Expand Up @@ -223,10 +228,11 @@ std::vector<std::vector<float>> OnlineDQMDigiAD::Inference(std::vector<float> &d

/**************** Inference ******************/

CPPUNIT_ASSERT_NO_THROW(output_values =
ort_mSession->run(input_names, input_values, input_shapes, output_names, batch_size));
//std::cout << "onnx model outputs size: " << output_values.size() << std::endl;
CPPUNIT_ASSERT(output_values.size() == output_names.size());
// CPPUNIT_ASSERT_NO_THROW(output_values = ort_mSession->run(input_names, input_values, input_shapes, output_names, batch_size));
output_values = ort_mSession->run(input_names, input_values, input_shapes, output_names, batch_size);

// std::cout << "onnx model outputs size: " << output_values.size() << std::endl;
// CPPUNIT_ASSERT(output_values.size() == output_names.size());

return output_values;
}
Expand Down Expand Up @@ -289,7 +295,7 @@ std::vector<std::vector<float>> OnlineDQMDigiAD::Inference_CMSSW(
//std::cout << "******* model inference is success *******" << std::endl;

/**************** Output post processing ******************/
CPPUNIT_ASSERT(output_tensors.size() == output_names.size());
// CPPUNIT_ASSERT(output_tensors.size() == output_names.size());

// split outputs into ad output vectors and state_memory vectors
std::string state_output_name_tag = "rnn_hidden";
Expand Down

0 comments on commit 51edc95

Please sign in to comment.