Remove "using namespace mlx::core" in python/src (#1689)

This commit is contained in:
Cheng
2024-12-12 08:45:39 +09:00
committed by GitHub
parent f3dfa36a3a
commit 0bf19037ca
22 changed files with 1423 additions and 1302 deletions

View File

@@ -4,8 +4,8 @@
#include "mlx/array.h"
namespace mx = mlx::core;
namespace nb = nanobind;
using namespace mlx::core;
void tree_visit(
const std::vector<nb::object>& trees,
@@ -27,7 +27,7 @@ void tree_visit_update(
/**
* Fill a pytree (recursive dict or list of dict or list) in place with the
* given arrays. */
void tree_fill(nb::object& tree, const std::vector<array>& values);
void tree_fill(nb::object& tree, const std::vector<mx::array>& values);
/**
* Replace all the arrays from the src values with the dst values in the
@@ -35,28 +35,28 @@ void tree_fill(nb::object& tree, const std::vector<array>& values);
*/
void tree_replace(
nb::object& tree,
const std::vector<array>& src,
const std::vector<array>& dst);
const std::vector<mx::array>& src,
const std::vector<mx::array>& dst);
/**
* Flatten a tree into a vector of arrays. If strict is true, then the
* function will throw if the tree contains a leaf which is not an array.
*/
std::vector<array> tree_flatten(nb::object tree, bool strict = true);
std::vector<mx::array> tree_flatten(nb::object tree, bool strict = true);
/**
* Unflatten a tree from a vector of arrays.
*/
nb::object tree_unflatten(
nb::object tree,
const std::vector<array>& values,
const std::vector<mx::array>& values,
int index = 0);
std::pair<std::vector<array>, nb::object> tree_flatten_with_structure(
std::pair<std::vector<mx::array>, nb::object> tree_flatten_with_structure(
nb::object tree,
bool strict = true);
nb::object tree_unflatten_from_structure(
nb::object structure,
const std::vector<array>& values,
const std::vector<mx::array>& values,
int index = 0);