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?
How do I get integral value (
intorunsigned int) fromxt::sum()to return from functionf2()?I tried:
which causes
Segmentation fault (core dumped).This version doesn't compile
no viable conversion from returned value of type 'reducer_type':How to convert
reducer_typetoint?