Вы можете использовать функцию xt :: adapt из xadapt.hpp, но вам нужно указать форму:
float* data = output->mutable_cpu_data();
size_t size = size_of_data;
// For a 1D tensor for instance
xt::static_shape<std::size_t, 1> sh = { size_of_data};
// Parameters of adapt are:
// - the 1D buffer to adapt
// - the size of the buffer
// - the ownership flag (should the adaptor destroy your buffer upon deletion, here
// probably not)
// - the shape
auto a = xt::adapt(data, size_of_data, false sh);
Преимущество по сравнению с решением, предоставленным Naidu, заключается в том, что вы не копируетебуфер данных, он адаптирован "на месте".