Add isfinite (#1318)

* isfinite

* remove reduce test since fix is not complete
This commit is contained in:
Awni Hannun
2024-08-13 14:49:28 -07:00
committed by GitHub
parent a098bc92e0
commit eaaea02010
5 changed files with 129 additions and 46 deletions

View File

@@ -1378,6 +1378,10 @@ array isinf(const array& a, StreamOrDevice s /* = {} */) {
return logical_or(isposinf(a, s), isneginf(a, s), s);
}
array isfinite(const array& a, StreamOrDevice s /* = {} */) {
return logical_not(logical_or(isinf(a, s), isnan(a, s), s), s);
}
array isposinf(const array& a, StreamOrDevice s /* = {} */) {
if (issubdtype(a.dtype(), integer) || a.dtype() == bool_) {
return full(a.shape(), false, bool_, s);