9    const device T* src [[buffer(0)]],
 
   10    device T* out [[buffer(1)]],
 
   11    const constant 
int* src_shape [[buffer(2)]],
 
   12    const constant 
size_t* src_strides [[buffer(3)]],
 
   13    const constant 
size_t& src_ndim [[buffer(4)]],
 
   14    const constant 
int* slice_sizes [[buffer(5)]],
 
   15    const constant 
int* axes [[buffer(6)]],
 
   17    uint2 index [[thread_position_in_grid]],
 
   18    uint2 grid_dim [[threads_per_grid]]) {
 
   19  auto ind_idx = index.x;
 
   20  auto ind_offset = index.y;
 
   23  for (
int i = 0; i < NIDX; ++i) {
 
   27    } 
else if (IDX_NDIM == 1) {
 
   28      idx_loc = ind_idx * indices.strides[indices.ndim * i];
 
   32          &indices.shapes[indices.ndim * i],
 
   33          &indices.strides[indices.ndim * i],
 
   37    auto idx_val = 
offset_neg_idx(indices.buffers[i][idx_loc], src_shape[ax]);
 
   38    src_idx += idx_val * src_strides[ax];
 
   41  auto src_offset = 
elem_to_loc(ind_offset, slice_sizes, src_strides, src_ndim);
 
   43  size_t out_idx = index.y + 
static_cast<size_t>(grid_dim.y) * index.x;
 
   44  out[out_idx] = src[src_offset + src_idx];
 
 
METAL_FUNC void gather_impl(const device T *src, device T *out, const constant int *src_shape, const constant size_t *src_strides, const constant size_t &src_ndim, const constant int *slice_sizes, const constant int *axes, const thread Indices< IdxT, NIDX > &indices, uint2 index, uint2 grid_dim)
Definition gather.h:8