MCPcopy Create free account
hub / github.com/ml-explore/mlx / array_equal

Function array_equal

mlx/ops.cpp:1818–1837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1816}
1817
1818array array_equal(
1819 const array& a,
1820 const array& b,
1821 bool equal_nan,
1822 StreamOrDevice s /* = {} */) {
1823 if (a.shape() != b.shape()) {
1824 return array(false);
1825 } else {
1826 auto dtype = promote_types(a.dtype(), b.dtype());
1827 equal_nan &= issubdtype(dtype, inexact);
1828 return all(
1829 array(
1830 a.shape(),
1831 bool_,
1832 std::make_shared<Equal>(to_stream(s), equal_nan),
1833 {astype(a, dtype, s), astype(b, dtype, s)}),
1834 false,
1835 s);
1836 }
1837}
1838
1839array isnan(const array& a, StreamOrDevice s /* = {} */) {
1840 if (issubdtype(a.dtype(), integer) || a.dtype() == bool_) {

Callers

nothing calls this directly

Calls 6

promote_typesFunction · 0.85
issubdtypeFunction · 0.85
to_streamFunction · 0.85
astypeFunction · 0.85
arrayFunction · 0.70
allFunction · 0.70

Tested by

no test coverage detected