Open
Description
I tried to adapt a splat tensor. However, xtensor threw a runtime error with message xbuffer_storage not resizable
. It seems that xtensor expects that buffer size equals to tensor size. I don't think that would be the case with user-provided strides.
#include <xtensor/xadapt.hpp>
#include <xtensor/xio.hpp>
#include <array>
int main()
{
const float data = 1;
const std::array<int, 2> shape = { 2, 2 };
const std::array<int, 2> strides = { 0, 0 };
// Expected
std::cout << xt::adapt(&data, 1, xt::no_ownership(), shape, strides) << '\n';
// Actual working
std::cout << xt::adapt(&data, 4, xt::no_ownership(), shape, strides) << '\n';
}