taichi
taichi copied to clipboard
Support ndarray deepcopy in C++ wrapper of AOT api
There're cases where users would want a deepcopy of an ndarray, so we can probably provide this as
auto arr_copy = arr.clone()
in our C++ wrapper. cc: @YuCrazing
What's the intent tho? Do you want an actual deep-copy or just something like np.zeros_like?
In my case, I want an actual deep-copy. I would like to copy all data from ndarray A into ndarray B with the least codes. If we have a deep-copy interface, we do not need write codes like this:
auto B = allocate_ndarray(A.shape, A.elem_shape, ...);
memcpy_d2d(B, A);
hmm okay. there would be something like a clone.