diff --git a/index.bs b/index.bs index 0bd93e74..0a01aabc 100644 --- a/index.bs +++ b/index.bs @@ -1105,6 +1105,8 @@ An {{MLOperand}}'s dataType is its {{MLOperand/[[descri Since the {{MLOperand/[[builder]]}} object is bound by the {{MLGraphBuilder/constructor()}} constructor to an {{MLContext}} object, an {{MLOperand}} is also always bound to the same {{MLContext}} object. +If an operation supports only a subset of {{MLOperandDataType}}s, the allowed data types for each operation's input operands, including both positional arguments and options, are given as either an explicit list of {{MLOperandDataType}}s, or a constraint that the operand's [=MLOperand/dataType=] must be the same type as the [=MLOperand/dataType=] of another input operand. + ### Creating an {{MLOperand}} ### {#api-mloperand-create} The {{MLOperand}} objects are created by the methods of {{MLGraphBuilder}}, internally using the following algorithms. @@ -1551,6 +1553,27 @@ partial interface MLGraphBuilder { - *options*: an optional {{MLBatchNormalizationOptions}}. Specifies the optional parameters of the operation. **Returns:** an {{MLOperand}}. The batch-normalized N-D tensor of the same shape as *input*. + + [=allowed data types|Types=]: +
+ - {{input}}: {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + - {{mean}}: [=/same as=] {{input}} + - {{variance}}: [=/same as=] {{input}} + - {{MLBatchNormalizationOptions/scale}}: [=/same as=] {{input}} + - {{MLBatchNormalizationOptions/bias}}: [=/same as=] {{input}} +
+ + +Another option for presentation, just throwing it out there: + +
+
+{{input}}: {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}
+{{mean}}: [=/same as=] {{input}}
+{{variance}}: [=/same as=] {{input}}
+{{MLBatchNormalizationOptions/scale}}: [=/same as=] {{input}}
+{{MLBatchNormalizationOptions/bias}}: [=/same as=] {{input}}
+
@@ -1559,20 +1582,20 @@ partial interface MLGraphBuilder { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |mean|, |variance|, |options|.{{MLBatchNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLBatchNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/activation}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/axis}} is not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, then [=exception/throw=] a {{TypeError}}. - 1. If |mean|'s [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If |mean|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |mean|'s [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. 1. If |mean|'s [=MLOperand/shape=][0] 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/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |variance|'s [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. 1. If |variance|'s [=MLOperand/shape=][0] is not equal to |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}], then [=exception/throw=] a {{TypeError}}. 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/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not equal to |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not equal to |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/activation}} [=map/exists=], and running its [=MLActivation/validation steps=]] with |input|.{{MLOperand/[[descriptor]]}} returns false, then [=exception/throw=] a {{TypeError}}.