Problem
catgrad's interpreter::backend::Backend generally assumes that ops take ownership of tensors.
This means they can deallocate them, or even re-use input tensors to write outputs, avoiding allocating additional memory.
However, parameters cannot have ownership transferred without (inefficiently) cloning the whole tensor.
Task
Change Backend::NdArray type for ndarray backend to use ArcArrayD instead (so we can cheaply clone parameter tensors).
Outcome
- Patched
ndarray backend using ArcArrayD for its NdArray type
- Criterion Benchmark showing improvement over baseline (current) implementation
Problem
catgrad's
interpreter::backend::Backendgenerally assumes that ops take ownership of tensors.This means they can deallocate them, or even re-use input tensors to write outputs, avoiding allocating additional memory.
However, parameters cannot have ownership transferred without (inefficiently) cloning the whole tensor.
Task
Change Backend::NdArray type for
ndarraybackend to use ArcArrayD instead (so we can cheaply clone parameter tensors).Outcome
ndarraybackend usingArcArrayDfor itsNdArraytype