mlx/python/src/convert.h

19 lines
416 B
C
Raw Normal View History

// Copyright © 2024 Apple Inc.
#include <optional>
#include <nanobind/nanobind.h>
#include <nanobind/ndarray.h>
#include "mlx/array.h"
namespace nb = nanobind;
using namespace mlx::core;
array nd_array_to_mlx(
nb::ndarray<nb::ro, nb::c_contig, nb::device::cpu> nd_array,
std::optional<Dtype> dtype);
2024-05-17 07:11:37 +08:00
nb::ndarray<nb::numpy> mlx_to_np_array(const array& a);
2024-05-17 07:11:37 +08:00
nb::ndarray<> mlx_to_dlpack(const array& a);