Skip to content

Commit

Permalink
compatible with custom ops without a custom domain
Browse files Browse the repository at this point in the history
Signed-off-by: daquexian <[email protected]>
  • Loading branch information
daquexian committed Dec 18, 2023
1 parent e0ddd0e commit 9589dd9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion onnxsim/onnxsim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,13 @@ onnx::ModelProto _FoldConstant(const onnx::ModelProto& model) {
model.CopyFrom(tmp);
const auto [const_nodes, non_const_nodes] = GetConstantNodes(model);
for (const auto& x : const_nodes) {
RunOpAndAddInitializer(model, x);
try {
RunOpAndAddInitializer(model, x);
} catch (const std::exception& e) {
std::cerr << "WARNING: failed to run \"" << node.op_type() <<
"\" op (name is \"" << node.name << "\"), skip..." << std::endl;
non_const_nodes.push_back(x);
}
}
model.mutable_graph()->clear_node();
for (const auto& x : non_const_nodes) {
Expand Down

0 comments on commit 9589dd9

Please sign in to comment.