8000 `argmax` with axis return argmin in 0.24.2 if expression dimension == 1 · Issue #2550 · xtensor-stack/xtensor · GitHub
[go: up one dir, main page]

Skip to content
argmax with axis return argmin in 0.24.2 if expression dimension == 1 #2550
@torshind

Description

@torshind

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0