xtl
xtl copied to clipboard
How to get integral value from xt::sum()?
How do I get integral value (int or unsigned int) from xt::sum() to return from function f2()?
I tried:
int f2(const xt::xtensor_fixed<uint8_t, xt::xshape<H, W>> &img) {
return xt::sum(xt::argmax(img, 1))();
}
which causes Segmentation fault (core dumped).
This version doesn't compile no viable conversion from returned value of type 'reducer_type':
int f2(const xt::xtensor_fixed<uint8_t, xt::xshape<H, W>> &img) {
return xt::sum<int>(xt::argmax(img, 1));
}
How to convert reducer_type to int?