Added formatter structure and a boolean value formatter (#354)

* added formatter structure and a boolean value formatter

---------

Co-authored-by: Awni Hannun <[email protected]>
This commit is contained in:
toji
2024-01-18 07:49:41 -08:00
committed by GitHub
co-authored by Awni Hannun
parent d1fef34138
commit 49a52610b7
4 changed files with 64 additions and 3 deletions
+3
View File
@@ -520,6 +520,9 @@ class ArrayPythonIterator {
};
void init_array(py::module_& m) {
// Set Python print formatting options
mlx::core::global_formatter.capitalize_bool = true;
// Types
py::class_<Dtype>(
m,
+1 -1
View File
@@ -304,7 +304,7 @@ class TestArray(mlx_tests.MLXTestCase):
def test_array_repr(self):
x = mx.array(True)
self.assertEqual(str(x), "array(true, dtype=bool)")
self.assertEqual(str(x), "array(True, dtype=bool)")
x = mx.array(1)
self.assertEqual(str(x), "array(1, dtype=int32)")
x = mx.array(1.0)