Skip to content

Commit bbb6dbf

Browse files
authored
[WebNN EP] Update data type constraints for Reduction ops (#20912)
WebNN Spec adds missing 64-bit integers support for `reduceL1`, `reduceSum`, `reduceSumSquare` and `reduceProduct` ops at this [PR](webmachinelearning/webnn#695), which has already been implemented in Chromium. Update corresponding data type constraints in WebNN EP. Besides, WebNN CPU backend currently doesn't support `uint64` and `uint32` for these ops.
1 parent 8aa2667 commit bbb6dbf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

onnxruntime/core/providers/webnn/builders/impl/reduction_op_builder.cc

+7-2
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,15 @@ bool ReductionOpBuilder::HasSupportedInputsImpl(const Node& node, const WebnnDev
162162
ONNX_NAMESPACE::TensorProto_DataType_FLOAT16,
163163
ONNX_NAMESPACE::TensorProto_DataType_INT32,
164164
ONNX_NAMESPACE::TensorProto_DataType_UINT32,
165+
ONNX_NAMESPACE::TensorProto_DataType_INT64,
166+
ONNX_NAMESPACE::TensorProto_DataType_UINT64,
165167
};
166-
// WebNN CPU backend doesn't support uint32 for reduceProd and reduceSum.
167-
if (device_type == WebnnDeviceType::CPU && (op_type == "ReduceProd" || op_type == "ReduceSum")) {
168+
169+
if (device_type == WebnnDeviceType::CPU) {
170+
// WebNN CPU backend doesn't support uint32 and uint64 for reduceL1,
171+
// reduceProd, reduceSum and reduceSumSquare.
168172
supported_data_types.erase(ONNX_NAMESPACE::TensorProto_DataType_UINT32);
173+
supported_data_types.erase(ONNX_NAMESPACE::TensorProto_DataType_UINT64);
169174
}
170175
} else if (op_type == "ReduceL2" || op_type == "ReduceLogSum" ||
171176
op_type == "ReduceLogSumExp" || op_type == "ReduceMean") {

0 commit comments

Comments
 (0)