-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Regarding to the current definition of MLOperandDescriptor
dictionary MLOperandDescriptor {
// The operand type.
required MLOperandType type;
// The dimensions field is only required for tensor operands.
sequence<unsigned long> dimensions;
};there is no definition of the maximum number of the dimensions sequence in spec.
However, for implementation, the native ML APIs usually have the maximum supported size. For example:
| Constant | Value | Description |
|---|---|---|
| DML_TENSOR_DIMENSION_COUNT_MAX | 5 | DirectML tensors support a maximum of 5 dimensions for DML_TARGET_VERSION < DML_FEATURE_LEVEL_3_0. |
| DML_TENSOR_DIMENSION_COUNT_MAX1 | 8 | DirectML tensors support a maximum of 8 dimensions for DML_TARGET_VERSION >= DML_FEATURE_LEVEL_3_0. |
And there may be per operator definitions, such as for convolution operator, the maximum dimensions count is 5, for element-wise add operator, the maximum dimensions count is 8. Thanks @fdwr sharing this information!
In a Chromium CL review, @RafaelCintron (Thanks!) mentions
we should have a better solution for web developers to know ahead of time which operator parameters are expected to fail and which will not so they can know which models to use. Requiring JS error string parsing for each browser vendor is not a great solution.
Rafael also shared that WebGPU solved a similar problem with "limits" https://gpuweb.github.io/gpuweb/#limits.