Skip to content

New proposal for handling tensor views

Olivier BICHLER requested to merge view into dev

This is a new proposal for handling views in Tensor.

Compared to !13 (closed), this proposal does not change the interface of TensorImpl and does not require low level Extract() implementation. It also adds missing essential facilities, such as isContiguous(), makeContiguous() and refContiguous().

What is in this MR?

  • mImpl is now shared_ptr instead of unique_ptr, with removed dependence to Tensor in TensorImpl;
  • Added mImplOffset parameter for data offset of the current Tensor w.r.t. shared implementation;
  • Added mStrides parameter to Tensor;
  • Tensor copy-ctor and assignment operators now make a shallow copy (when possible). Added a clone() function for deep copy;
  • Added 2 extract() functions for extracting a sub-tensor;
  • Added a makeContiguous() function to make memory contiguous (and refContiguous() on the same model as refCastFrom()).
  • resize() behavior currently is to throw if one tries to change de size with a shared implementation.
    • Alternative behavior(?): make a new implementation during resize and stop sharing previous implementation.
Edited by Olivier BICHLER

Merge request reports

Loading