MCPcopy Create free account
hub / github.com/ml-explore/mlx / mlx_func

Function mlx_func

python/src/mlx_func.cpp:98–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96static PyTypeObject* gc_func_tp = nullptr;
97
98nb::callable mlx_func(
99 nb::object func,
100 const nb::callable& orig_func,
101 std::vector<PyObject*> deps) {
102 gc_func* r = (gc_func*)PyType_GenericAlloc(gc_func_tp, 0);
103 r->func = func.inc_ref().ptr();
104 r->orig_func = orig_func.ptr();
105 deps.push_back(r->orig_func);
106 r->deps = std::move(deps);
107 r->vectorcall = gc_func_vectorcall;
108 return nb::steal<nb::callable>((PyObject*)r);
109}
110
111void init_mlx_func(nb::module_& m) {
112 gc_func_tp = (PyTypeObject*)PyType_FromSpec(&gc_func_spec);

Callers

nothing calls this directly

Calls 2

ptrMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected