diff --git a/index.bs b/index.bs index bf525640..d7a16bee 100644 --- a/index.bs +++ b/index.bs @@ -44,6 +44,7 @@ urlPrefix: https://tc39.es/ecma262/; spec: ECMA-262 text: element size; url: table-the-typedarray-constructors text: element type; url: table-the-typedarray-constructors text: view constructor; url: table-the-typedarray-constructors + text: equally close values; url: sec-ecmascript-language-types-number-type
@@ -1089,6 +1090,8 @@ interface MLOperand {
MLOperandDataType dataType();
sequence shape();
};
+
+typedef (bigint or unrestricted double) MLNumber;
@@ -1148,6 +1151,16 @@ The {{MLOperand}} objects are created by the methods of {{MLGraphBuilder}}, inte
To validate operand given {{MLGraphBuilder}} |builder| and {{MLOperand}} |operand|, return true if |operand|.{{MLOperand/[[builder]]}} is |builder|, and false otherwise.
+#### {{MLNumber}} #### {#api-mlnumber-typedef}
+
+MLNumber is used when specifying the type of a numeric option for an {{MLOperand}} which can be of any {{MLOperandDataType}}, including both 64-bit integer types ({{MLOperandDataType/"uint64"}} and {{MLOperandDataType/"int64"}}) and 32-bit floating point ({{MLOperandDataType/"float32"}}). Implementations process the value according to the corresponding {{MLOperandDataType}}. For example, if {{MLGraphBuilder/clamp(input, options)}} is called with an {{MLOperand}} with [=MLOperand/dataType=] {{MLOperandDataType/"uint32"}}, the {{MLNumber}} parameters are explicitly [=cast=] to {{unsigned long}}.
+
+
+ Specifying the option as {{double}} would lose accuracy when passing values over 253, and specifying {{long long}} would disallow values over 263.
+
+
+Issue(whatwg/webidl#1388): Support for unions of {{bigint}} and [=numeric types=] new in [[WEBIDL]], and implementation support is also limited. Prototype implementations are encouraged to provide feedback for this approach.
+
### {{MLOperand/dataType()}} ### {#api-mloperand-datatype}
Return a data type of the {{MLOperand}}.
@@ -1247,7 +1260,7 @@ interface MLGraphBuilder {
MLOperand constant(MLOperandDescriptor descriptor, ArrayBufferView bufferView);
// Create a scalar operand from the specified number of the specified type.
- MLOperand constant(MLOperandDataType type, double value);
+ MLOperand constant(MLOperandDataType type, MLNumber value);
// Compile the graph up to the specified output operands asynchronously.
Promise build(MLNamedOperands outputs);
@@ -1341,7 +1354,7 @@ Data truncation will occur when the specified value exceeds the range of the spe
**Arguments:**
- *type*: an {{MLOperandDataType}}.
- - *value*: a {{float}} number. The value of the scalar constant.
+ - *value*: an {{MLNumber}}. The value of the constant.
**Returns:** an {{MLOperand}}. The constant output.
@@ -1349,6 +1362,7 @@ Data truncation will occur when the specified value exceeds the range of the spe
The constant(|type|, |value|) method steps are:
+ 1. Set |value| to the result of [=casting=] |value| to |type|.
1. Let |descriptor| be a new {{MLOperandDescriptor}}.
1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |type|.
1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to an empty [=/list=].
@@ -1492,7 +1506,7 @@ dictionary MLBatchNormalizationOptions {
MLOperand scale;
MLOperand bias;
[EnforceRange] unsigned long axis = 1;
- float epsilon = 1e-5;
+ double epsilon = 1e-5;
};
partial interface MLGraphBuilder {
@@ -1541,6 +1555,7 @@ partial interface MLGraphBuilder {
1. If |mean|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}.
1. If |variance|'s [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
1. If |variance|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}.
+ 1. Set |options|.{{MLBatchNormalizationOptions/epsilon}} to the result of [=casting=] |options|.{{MLBatchNormalizationOptions/epsilon}} to |input|'s [=MLOperand/dataType=].
1. If |options|.{{MLBatchNormalizationOptions/scale}} [=map/exists=]:
1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}.
@@ -1614,8 +1629,8 @@ partial interface MLGraphBuilder {
Clamp the input tensor element-wise within a range specified by the minimum and maximum values.