mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Remove thrust iterators (#2396)
This commit is contained in:
@@ -49,6 +49,20 @@ store_vector(T* ptr, uint32_t offset, const AlignedVector<T, N>& vec) {
|
||||
to[offset] = vec;
|
||||
}
|
||||
|
||||
// Helper for accessing strided data.
|
||||
template <typename T>
|
||||
struct StridedIterator {
|
||||
T it;
|
||||
int64_t stride;
|
||||
|
||||
__host__ __device__ StridedIterator(T it, int64_t stride)
|
||||
: it(it), stride(stride) {}
|
||||
|
||||
__host__ __device__ auto operator[](int i) const {
|
||||
return it[i * stride];
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Type limits utils
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user