coreylowman / cudarc

Safe rust wrapper around CUDA toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copy from `CudaView`

M1ngXU opened this issue · comments

commented

Sometimes you only need a specific part of a CudaSlice and copying from a CudaView would be very useful (and why can you only slice with a RangeFrom?)

Can you give example of copying in that manner?

I initially did RangeFrom to make it clear that there is no concept of length for CudaViews. Perhaps with what you are thinking about (copying from CudaView) we could add length and then make the range more generic.

commented

if i have a large CudaSlice but only want to copy let's say 100 elements out of it (first 100), then you would have to copy the whole slice and slice the slice you just copied out ...

This is needed for the stack operation in dfdx - notably you allocate enough space for all the tensors you are stacking, then copy values into sub views