From 3787167fb20922b75d06c74f5ecb993199d840ce Mon Sep 17 00:00:00 2001 From: Hyunsung Lee Date: Sun, 20 Apr 2025 22:47:37 +0900 Subject: [PATCH] nit --- python/src/ops.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/python/src/ops.cpp b/python/src/ops.cpp index e858f7e8f..19d089446 100644 --- a/python/src/ops.cpp +++ b/python/src/ops.cpp @@ -5200,16 +5200,12 @@ void init_ops(nb::module_& m) { shape_vec.reserve(shapes.size()); for (size_t i = 0; i < shapes.size(); ++i) { - mx::Shape shape; - if (nb::isinstance(shapes[i]) || - nb::isinstance(shapes[i])) { - shape = nb::cast(shapes[i]); - } else { + if (!nb::isinstance(shapes[i]) && + !nb::isinstance(shapes[i])) throw std::invalid_argument( "broadcast_shapes expects a sequence of shapes (tuple or list of ints)"); - } - shape_vec.push_back(shape); + shape_vec.push_back(nb::cast(shapes[i])); } mx::Shape result = shape_vec[0];