xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

Slice iteration not working with xt::xtensor

Open czajah opened this issue 3 years ago • 0 comments

    xt::xtensor<float_type,3> a = {{{1, 2, 3, 4},
                             {5, 6, 7, 8},
                             {9, 10, 11, 12}},
                     {{13, 14, 15, 16},
                             {17, 18, 19, 20},
                             {21, 22, 23, 24}}};

    auto a_iter = xt::axis_slice_begin(a, 2u);
    auto a_end = xt::axis_slice_end(a, 2u);

    while(a_iter != a_end)
    {
        std::cout << *a_iter++ << std::endl;
    }

produces:

{}
{}
{}
{}
{}
{}

while after change from xt::xtensor<float_type,3> to xt::xarray<float_type> produces expected output

{ 1.,  2.,  3.,  4.}
{ 5.,  6.,  7.,  8.}
{  9.,  10.,  11.,  12.}
{ 13.,  14.,  15.,  16.}
{ 17.,  18.,  19.,  20.}
{ 21.,  22.,  23.,  24.}

xtensor built from master (last commit d1499d900733cd089bd868ca1ca5fdce01e89b97)

czajah avatar May 23 '22 10:05 czajah