Use SmallVector for shapes and strides

This commit is contained in:
Cheng
2025-08-01 21:38:10 +09:00
parent be9bc96da4
commit 68e9c60d22
30 changed files with 677 additions and 101 deletions

17
python/src/small_vector.h Normal file
View File

@@ -0,0 +1,17 @@
// Copyright © 2025 Apple Inc.
#pragma once
#include "mlx/small_vector.h"
#include <nanobind/stl/detail/nb_list.h>
NAMESPACE_BEGIN(NB_NAMESPACE)
NAMESPACE_BEGIN(detail)
template <typename Type, size_t Size, typename Alloc>
struct type_caster<mlx::core::SmallVector<Type, Size, Alloc>>
: list_caster<mlx::core::SmallVector<Type, Size, Alloc>, Type> {};
NAMESPACE_END(detail)
NAMESPACE_END(NB_NAMESPACE)