2023-12-01 03:12:53 +08:00
|
|
|
// Copyright © 2023 Apple Inc.
|
|
|
|
|
2023-11-30 02:52:08 +08:00
|
|
|
#include <pybind11/pybind11.h>
|
|
|
|
|
|
|
|
#define STRINGIFY(x) #x
|
|
|
|
#define TOSTRING(x) STRINGIFY(x)
|
|
|
|
|
|
|
|
namespace py = pybind11;
|
|
|
|
|
|
|
|
void init_array(py::module_&);
|
|
|
|
void init_device(py::module_&);
|
|
|
|
void init_stream(py::module_&);
|
|
|
|
void init_metal(py::module_&);
|
|
|
|
void init_ops(py::module_&);
|
|
|
|
void init_transforms(py::module_&);
|
|
|
|
void init_random(py::module_&);
|
|
|
|
void init_fft(py::module_&);
|
2023-12-27 11:42:04 +08:00
|
|
|
void init_linalg(py::module_&);
|
2024-01-11 22:47:29 +08:00
|
|
|
void init_constants(py::module_&);
|
2024-02-15 06:04:25 +08:00
|
|
|
void init_extensions(py::module_&);
|
2023-11-30 02:52:08 +08:00
|
|
|
|
|
|
|
PYBIND11_MODULE(core, m) {
|
2023-12-14 11:48:00 +08:00
|
|
|
m.doc() = "mlx: A framework for machine learning on Apple silicon.";
|
2023-11-30 02:52:08 +08:00
|
|
|
|
|
|
|
auto reprlib_fix = py::module_::import("mlx._reprlib_fix");
|
|
|
|
|
|
|
|
init_device(m);
|
|
|
|
init_stream(m);
|
|
|
|
init_array(m);
|
|
|
|
init_metal(m);
|
|
|
|
init_ops(m);
|
|
|
|
init_transforms(m);
|
|
|
|
init_random(m);
|
|
|
|
init_fft(m);
|
2023-12-27 11:42:04 +08:00
|
|
|
init_linalg(m);
|
2024-01-11 22:47:29 +08:00
|
|
|
init_constants(m);
|
2024-02-15 06:04:25 +08:00
|
|
|
init_extensions(m);
|
2023-11-30 02:52:08 +08:00
|
|
|
m.attr("__version__") = TOSTRING(_VERSION_);
|
|
|
|
}
|