Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions onnxruntime/core/providers/webnn/builders/helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ bool IsTensorShapeSupported(const NodeArg& node_arg, const std::string& parent_n
<< "use sessionOptions.FreeDimensionOverrides to set a fixed shape: " << node_arg_name;
return false;
}
if (dim.dim_value() == 0) {
LOGS(logger, VERBOSE) << "The shape of [" << node_arg_name << "] has 0 dimension which is not supported by WebNN";
return false;
}
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
LOGS(logger, VERBOSE) << "Cannot get shape.";
return false;
}
if (std::any_of(new_shape.begin(), new_shape.end(), [](int64_t dimension) { return dimension == 0; })) {

Check warning on line 91 in onnxruntime/core/providers/webnn/builders/impl/expand_op_builder.cc

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Controlled statements inside brackets of if clause should be on a separate line [whitespace/newline] [5] Raw Output: onnxruntime/core/providers/webnn/builders/impl/expand_op_builder.cc:91: Controlled statements inside brackets of if clause should be on a separate line [whitespace/newline] [5]
LOGS(logger, VERBOSE) << "WebNN expand does not support new shape with 0 dimension.";
return false;
}

std::vector<int64_t> input_shape;
if (!GetShape(*input_defs[0], input_shape, logger)) {
Expand Down
Loading