mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
WIP (common)
This commit is contained in:
@@ -24,8 +24,8 @@ std::tuple<int64_t, Strides> prepare_slice(
|
|||||||
void shared_buffer_slice(
|
void shared_buffer_slice(
|
||||||
const array& in,
|
const array& in,
|
||||||
const Strides& out_strides,
|
const Strides& out_strides,
|
||||||
size_t data_offset,
|
int64_t data_offset,
|
||||||
size_t data_size,
|
int64_t data_size,
|
||||||
array& out) {
|
array& out) {
|
||||||
// Compute row/col contiguity
|
// Compute row/col contiguity
|
||||||
auto [no_bsx_size, is_row_contiguous, is_col_contiguous] =
|
auto [no_bsx_size, is_row_contiguous, is_col_contiguous] =
|
||||||
@@ -61,7 +61,7 @@ void slice(
|
|||||||
if (data_end < 0) {
|
if (data_end < 0) {
|
||||||
data_end += in.data_size();
|
data_end += in.data_size();
|
||||||
}
|
}
|
||||||
size_t data_size = (data_end - data_offset);
|
int64_t data_size = (data_end - data_offset);
|
||||||
shared_buffer_slice(in, inp_strides, data_offset, data_size, out);
|
shared_buffer_slice(in, inp_strides, data_offset, data_size, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ struct ContiguousIterator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline auto check_contiguity(const Shape& shape, const Strides& strides) {
|
inline auto check_contiguity(const Shape& shape, const Strides& strides) {
|
||||||
size_t no_broadcast_data_size = 1;
|
int64_t no_broadcast_data_size = 1;
|
||||||
int64_t f_stride = 1;
|
int64_t f_stride = 1;
|
||||||
int64_t b_stride = 1;
|
int64_t b_stride = 1;
|
||||||
bool is_row_contiguous = true;
|
bool is_row_contiguous = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user