Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get integral value from xt::sum()? #277

Open
pauljurczak opened this issue Dec 21, 2023 · 0 comments
Open

How to get integral value from xt::sum()? #277

pauljurczak opened this issue Dec 21, 2023 · 0 comments

Comments

@pauljurczak
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant