I have been testing the Tensor module from Eigen3 for a new project. Even when the module is not yet finished, it seems to have most of the functionality that I need.
But there is one part that I quite not get. Whenever I have a big Tensor and I want to extract a slice from it, Eigen makes a copy of the data.
Is there a way to not copy the data, but instead point to the original data block in the slice?
For example if I do:
Tensor<float, 3> A(100,1000,1000); A.setZero();
Eigen::array<int, 3> offsets = {0, 0, 0};
Eigen::array<int, 3> extents = {2, 2, 2};
Tensor<float, 3> c = A.slice(offsets, extents);
A(0,0,0) = 1.0;
cerr << c << endl;
But the first element of "c" is still zero, instead of mapping to the modified "A(0,0,0)" data block.
TensorRef
is an option. The implementation looks quite inefficient, though (using dynamic polymorphism). – Woadauto c = A.slice(offsets, extents);
an option? – Woad