Simplify MLPool2dOptions
by removing the outputSizes
option
#374
Labels
MLPool2dOptions
by removing the outputSizes
option
#374
This is proposed by @wacky6 (Thanks Jiewei!) in Chromium CL review.
MLPool2dOptions
hasroundingType
andoutputSizes
that both can control how an implementation calculates the shape of the output tensor. When the output sizes are explicitly specified, theoptions.roundingType
is ignored. If not specified, the output sizes are automatically computed.However, this design makes the implementation more complex. Specially, even if
outputSizes
is present, the implementation still needs to calculate the output tensor sizes for both "ceil" and "floor" rounding types for validating the user-suppliedoutputSizes
, like Chromium's implementation. Removing the support ofoutputSizes
option would help simplify the implementation.Because the current frameworks widely support rounding type for pooling operators, such as PyTorch, ONNX and TensorFlow (only supports ceil mode), they can map to WebNN's
MLPool2dOptions.roundingType
directly without using theoutputSizes
option.For native ML APIs that require the output sizes, like DirectML
DML_AVERAGE_POOLING_OPERATOR_DESC
and XNNPACKxnn_define_global_average_pooling_2d
, WebNN implementation can set the calculated output sizes to them. For native ML APIs that accept rounding type, such as MPSGraphMPSGraphPooling2DOpDescriptor
, WebNN implementation can mapMLPool2dOptions.roundingType
to native type./cc @wchao1115 @fdwr @pyu10055
The text was updated successfully, but these errors were encountered: