handle exceptions caused by model probing
@@ -302,6 +302,7 @@ Onnx::WirePlanner::need_model_probe(const Onnx &model) const
void
Onnx::WirePlanner::do_model_probe(const Onnx &model)
{
+ try {
std::vector<Ort::Value> param_values;
param_values.reserve(model.inputs().size());
for (const auto &input: model.inputs()) {
@@ -325,6 +326,10 @@ Onnx::WirePlanner::do_model_probe(const Onnx &model)
for (size_t i = 0; i < model.outputs().size(); ++i) {
_output_types.emplace(model.outputs()[i].name, get_type_of(result_values[i]));
}
+ } catch (const Ort::Exception &ex) {
+ _output_types.clear();
+ LOG(warning, "model probe failed: %s", ex.what());
+ }
}
Onnx::WirePlanner::~WirePlanner() = default;
