mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-10 17:37:14 +00:00
[WebNN] Check split's output name (#22884)
Chromium will rename split's output name from "output" to "outputs" in `OpSupportLimits` to align with spec, the EP should check which name is available to make it compatible.
This commit is contained in:
parent
8a06f13301
commit
5b787121e8
1 changed files with 19 additions and 0 deletions
|
|
@ -28,6 +28,8 @@ class SplitOpBuilder : public BaseOpBuilder {
|
|||
private:
|
||||
bool IsOpSupportedImpl(const InitializedTensorSet& initializers, const Node& node,
|
||||
const WebnnDeviceType /* device_type */, const logging::Logger& logger) const override;
|
||||
bool HasSupportedOutputsImpl(const Node& node, const emscripten::val& wnn_limits,
|
||||
const logging::Logger& logger) const override;
|
||||
};
|
||||
|
||||
// Add operator related.
|
||||
|
|
@ -163,6 +165,23 @@ bool SplitOpBuilder::IsOpSupportedImpl(const InitializedTensorSet& initializers,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SplitOpBuilder::HasSupportedOutputsImpl(const Node& node,
|
||||
const emscripten::val& wnn_limits,
|
||||
const logging::Logger& logger) const {
|
||||
const auto& output_defs = node.OutputDefs();
|
||||
const auto& op_type = node.OpType();
|
||||
int32_t output_type = 0;
|
||||
|
||||
if (GetType(*output_defs[0], output_type, logger)) {
|
||||
// Chromium has changed the output name of split from 'output' to 'outputs',
|
||||
// to avoid breaking the existing API, we need to check both names.
|
||||
std::string wnn_output_name = wnn_limits["split"]["output"].isUndefined() ? "outputs" : "output";
|
||||
return IsDataTypeSupportedByOp(op_type, output_type, wnn_limits, wnn_output_name, "outputs", logger);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CreateSplitOpBuilder(const std::string& op_type, OpBuilderRegistrations& op_registrations) {
|
||||
op_registrations.builders.push_back(std::make_unique<SplitOpBuilder>());
|
||||
op_registrations.op_builder_map.emplace(op_type, op_registrations.builders.back().get());
|
||||
|
|
|
|||
Loading…
Reference in a new issue