xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

xt::tile An uncaught exception occurred: std::bad_alloc

Open marktohark opened this issue 1 year ago • 2 comments

version is 0.24.6

xt::xarray<int> t{{1, 2}, {3, 4}};
std::vector<int> rep = {2, 3};
auto tb = xt::tile(t, rep);
for(auto b : tb.shape())
    std::cout << b << " ";
std::cout << std::endl;

it will get an error "An uncaught exception occurred: std::bad_alloc"

marktohark avatar Apr 21 '23 16:04 marktohark

Thanks for reporting. Just to make sure, tb.shape(0) and tb.shape(1) give what?

tdegeus avatar Apr 24 '23 09:04 tdegeus

exception is happend in xt::tile. so cannot get tb.shape

i use debug tool to trace, there is some clue. when t.dim >= 4, xt::tile is work well. i remember that "compute_size" get alloc size wrong. dim is 2, but compute_size will get 4.

marktohark avatar Apr 25 '23 01:04 marktohark