Skip to content

Commit

Permalink
clean up the implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z committed Oct 5, 2024
1 parent 544cb03 commit 34d94d5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions code/numpy/create.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ mp_obj_t create_take(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
}
out_array += a->itemsize;
}
} else {
} else {
// move the axis shape/stride to the leftmost position:
SWAP(size_t, a->shape[0], a->shape[axis]);
SWAP(size_t, out->shape[0], out->shape[axis]);
Expand Down Expand Up @@ -998,15 +998,11 @@ mp_obj_t create_take(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
#endif
}

// revert back to the original order
SWAP(size_t, a->shape[0], a->shape[axis]);
SWAP(size_t, out->shape[0], out->shape[axis]);
SWAP(int32_t, a->strides[0], a->strides[axis]);
SWAP(int32_t, out->strides[0], out->strides[axis]);

// m_del(size_t, a_shape, ULAB_MAX_DIMS);
// m_del(size_t, out_shape, ULAB_MAX_DIMS);
// m_del(int32_t, a_strides, ULAB_MAX_DIMS);
// m_del(int32_t, out_strides, ULAB_MAX_DIMS);
}
m_del(size_t, indices, indices_len);
return MP_OBJ_FROM_PTR(out);
Expand Down

0 comments on commit 34d94d5

Please sign in to comment.