mirror of
https://github.com/ml-explore/mlx.git
synced 2025-07-19 07:31:26 +08:00
Use Py_ssize_t in python bindings (#1678)
* Use Py_ssize_t in python bindings * Args passed to std::max must be same type
This commit is contained in:
parent
40c62c1321
commit
87d7a2520e
@ -56,13 +56,13 @@ std::string buffer_format(const array& a) {
|
|||||||
|
|
||||||
struct buffer_info {
|
struct buffer_info {
|
||||||
std::string format;
|
std::string format;
|
||||||
std::vector<ssize_t> shape;
|
std::vector<Py_ssize_t> shape;
|
||||||
std::vector<ssize_t> strides;
|
std::vector<Py_ssize_t> strides;
|
||||||
|
|
||||||
buffer_info(
|
buffer_info(
|
||||||
std::string format,
|
std::string format,
|
||||||
std::vector<ssize_t> shape_in,
|
std::vector<Py_ssize_t> shape_in,
|
||||||
std::vector<ssize_t> strides_in)
|
std::vector<Py_ssize_t> strides_in)
|
||||||
: format(std::move(format)),
|
: format(std::move(format)),
|
||||||
shape(std::move(shape_in)),
|
shape(std::move(shape_in)),
|
||||||
strides(std::move(strides_in)) {}
|
strides(std::move(strides_in)) {}
|
||||||
@ -91,8 +91,8 @@ extern "C" inline int getbuffer(PyObject* obj, Py_buffer* view, int flags) {
|
|||||||
a.eval();
|
a.eval();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ssize_t> shape(a.shape().begin(), a.shape().end());
|
std::vector<Py_ssize_t> shape(a.shape().begin(), a.shape().end());
|
||||||
std::vector<ssize_t> strides(a.strides().begin(), a.strides().end());
|
std::vector<Py_ssize_t> strides(a.strides().begin(), a.strides().end());
|
||||||
for (auto& s : strides) {
|
for (auto& s : strides) {
|
||||||
s *= a.itemsize();
|
s *= a.itemsize();
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ std::tuple<std::vector<array>, array, std::vector<int>> mlx_scatter_args_nd(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Analyse the types of the indices
|
// Analyse the types of the indices
|
||||||
unsigned long max_dim = 0;
|
size_t max_dim = 0;
|
||||||
bool arrays_first = false;
|
bool arrays_first = false;
|
||||||
int num_none = 0;
|
int num_none = 0;
|
||||||
int num_slices = 0;
|
int num_slices = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user