Download ml-stable-diffusion/mlx/python/src/convert.h from Fahad-S/FastVLM_SANA: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/Fahad-S/FastVLM_SANA/resolve/main/ml-stable-diffusion/mlx/python/src/convert.h
- Command line
-
hf download hf://Fahad-S/FastVLM_SANA/ml-stable-diffusion/mlx/python/src/convert.h
-
curl -L -o convert.h https://huggingface.co/Fahad-S/FastVLM_SANA/resolve/main/ml-stable-diffusion/mlx/python/src/convert.h
1.21 kB
| // Copyright © 2024 Apple Inc. | |
| namespace mx = mlx::core; | |
| namespace nb = nanobind; | |
| namespace nanobind { | |
| static constexpr dlpack::dtype bfloat16{4, 16, 1}; | |
| }; // namespace nanobind | |
| struct ArrayLike { | |
| ArrayLike(nb::object obj) : obj(obj) {}; | |
| nb::object obj; | |
| }; | |
| using ArrayInitType = std::variant< | |
| nb::bool_, | |
| nb::int_, | |
| nb::float_, | |
| // Must be above ndarray | |
| mx::array, | |
| // Must be above complex | |
| nb::ndarray<nb::ro, nb::c_contig, nb::device::cpu>, | |
| std::complex<float>, | |
| nb::list, | |
| nb::tuple, | |
| ArrayLike>; | |
| mx::array nd_array_to_mlx( | |
| nb::ndarray<nb::ro, nb::c_contig, nb::device::cpu> nd_array, | |
| std::optional<mx::Dtype> dtype); | |
| nb::ndarray<nb::numpy> mlx_to_np_array(const mx::array& a); | |
| nb::ndarray<> mlx_to_dlpack(const mx::array& a); | |
| nb::object to_scalar(mx::array& a); | |
| nb::object tolist(mx::array& a); | |
| mx::array create_array(ArrayInitType v, std::optional<mx::Dtype> t); | |
| mx::array array_from_list(nb::list pl, std::optional<mx::Dtype> dtype); | |
| mx::array array_from_list(nb::tuple pl, std::optional<mx::Dtype> dtype); | |