haskell icon indicating copy to clipboard operation
haskell copied to clipboard

Avoid unnecessary copies when fetching

Open judah opened this issue 8 years ago • 0 comments

Currently, to work around #92, we may do multiple unnecessary copies when fetching the result of a computation. (See also discussion in the PR #108.)

If the output type requires a copy anyway (e.g. [Int64] or Data.Unboxed.Vector Float), then that change caused the data to be copied twice: once to get a `Storable.Vector, and once to get the final type.

Instead, TensorData itself could wrap an S.IOVector instead of an S.Vector, and the Fetchable action could run in IO to extract the final type (with special logic for each type's instance to decide how much copying to do).

judah avatar May 09 '17 20:05 judah