xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

`argmax` with axis return argmin in 0.24.2 if expression dimension == 1

Open torshind opened this issue 2 years ago • 1 comments

Minimal code to reproduce:

#include <iostream>

#include <xtensor/xtensor.hpp>
#include <xtensor/xsort.hpp>

int main() {
    xt::xtensor<double, 1> xtest{0, 1, 2, 3, 4};

    std::cout << xt::argmax(xtest)(0) << std::endl;
    std::cout << xt::argmax(xtest, 0)(0) << std::endl;


    return 0;
}

0.24.1 output:

4
4

0.24.2 output:

4
0

With the debugger I noticed that the compare function is ignored if dimension is 1 and an argmin implementation is called: image

torshind avatar Jun 27 '22 11:06 torshind

Thanks for reporting. This is clearly a bug

tdegeus avatar Jul 26 '22 08:07 tdegeus