You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add isNaN and isInfinite operators
* Typo numberic
* Fix missing semicolon after function prototype
* Fix support limits type for unary isNan and isInfinite
* Ningxin's feedback about data type restriction
- *logicalAnd*: Compute the logical *and* of the two input tensors, element-wise, treating any non-zero value as true and returning elements of 0 or 1.
3646
3654
- *logicalOr*: Compute the logical *or* of the two input tensors, element-wise, treating any non-zero value as true and returning elements of 0 or 1.
3647
3655
- *logicalXor*: Compute the logical *xor* of the two input tensors, element-wise, treating any non-zero value as true and returning elements of 0 or 1.
3656
+
- *isNaN*: Check if the values of the input tensor are invalid numeric representations (NaN's), element-wise, returning 1's for NaN's and 0 otherwise.
3657
+
- *isInfinite*: Check if the values of the input tensor are infinite, element-wise, returning 1's for positive or negative infinity and 0 otherwise.
3648
3658
</div>
3649
3659
3650
3660
<div class="note">
@@ -3655,11 +3665,13 @@ Although operations {{MLGraphBuilder/greaterOrEqual()}} and {{MLGraphBuilder/les
3655
3665
<summary>
3656
3666
To <dfn for="MLGraphBuilder" data-lt="element-wise-logical-op">create an element-wise logical operation</dfn> given [=string=] |op|, {{MLOperand}} |a|, an optional {{MLOperand}} |b|, and {{MLOperatorOptions}} |options|, run the following steps:
3657
3667
</summary>
3658
-
1. [=Assert=]: |op| is one of "equal", "notEqual", "greater", "greaterOrEqual", "lesser", "lesserOrEqual", "logicalNot", "logicalAnd", "logicalOr", "logicalXor".
3668
+
1. [=Assert=]: |op| is one of "equal", "notEqual", "greater", "greaterOrEqual", "lesser", "lesserOrEqual", "logicalNot", "logicalAnd", "logicalOr", "logicalXor", "isNaN", "isInfinite".
3659
3669
1. If [=this=] [=MLGraphBuilder/can not build=], then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.
3660
3670
1. If [=MLGraphBuilder/validating operand=] with [=this=] and |a| returns false, then [=exception/throw=] a {{TypeError}}.
3661
3671
1. If |op| is one of "logicalNot", "logicalAnd", "logicalOr", "logicalXor", then:
3662
3672
1. If |a|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"uint8"}}, then [=exception/throw=] a {{TypeError}}.
3673
+
1. If |op| is one of "isNaN", "isInfinite", then:
3674
+
1. If |a|'s [=MLOperand/dataType=] is not one of « {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} », then [=exception/throw=] a {{TypeError}}.
3663
3675
1. If |b| is passed, then:
3664
3676
1. If [=MLGraphBuilder/validating operand=] with [=this=] and |b| returns false, then [=exception/throw=] a {{TypeError}}.
3665
3677
1. If |a|'s [=MLOperand/dataType=] is not equal to |b|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
@@ -3749,6 +3761,20 @@ Although operations {{MLGraphBuilder/greaterOrEqual()}} and {{MLGraphBuilder/les
3749
3761
1. If that [=exception/throws=] an error, then re-[=exception/throw=] the error.
3750
3762
1. Return |output|.
3751
3763
</div>
3764
+
3765
+
<div algorithm>
3766
+
The <dfn method for=MLGraphBuilder>isNaN(|a|, |options|)</dfn> method steps are:
3767
+
1. Let |output| be the result of [=MLGraphBuilder/element-wise-logical-op|creating an element-wise logical operation=] given "isNaN", |a|, and |options|.
3768
+
1. If that [=exception/throws=] an error, then re-[=exception/throw=] the error.
3769
+
1. Return |output|.
3770
+
</div>
3771
+
3772
+
<div algorithm>
3773
+
The <dfn method for=MLGraphBuilder>isInfinite(|a|, |options|)</dfn> method steps are:
3774
+
1. Let |output| be the result of [=MLGraphBuilder/element-wise-logical-op|creating an element-wise logical operation=] given "isInfinite", |a|, and |options|.
3775
+
1. If that [=exception/throws=] an error, then re-[=exception/throw=] the error.
0 commit comments