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

[BUG] indexing the second dim with af::seq ignores step #3525

Open
FloopCZ opened this issue Dec 19, 2023 · 0 comments
Open

[BUG] indexing the second dim with af::seq ignores step #3525

FloopCZ opened this issue Dec 19, 2023 · 0 comments
Assignees
Labels

Comments

@FloopCZ
Copy link
Contributor

FloopCZ commented Dec 19, 2023

Indexing the first dimension with af::array and the second dimension with af::seq ignores the step parameter of the af::seq. Casting the af::seq to af::array is a workaround for this issue.

Minimal example:

#include <arrayfire.h>

int main() {
    af::info();

    af::array A = af::seq(10);
    A = A.T();
    af::print("A", A);

    af::array selector_x = af::constant(0, 1);
    af::seq selector_y(0, 9, 2);  // select every second element
    // af::array selector_y = af::seq(0, 9, 2);  // this is a workaround

    af::print("A select", A(selector_x, selector_y));
}

Output:

ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Platform: CUDA Runtime 12.0, Driver: 545.29.02
[0] NVIDIA RTX A500 Laptop GPU, 3905 MB, CUDA Compute 8.6
A
[1 10 1 1]
   Offset: 0
   Strides: [1 1 10 10]
    0.0000     1.0000     2.0000     3.0000     4.0000     5.0000     6.0000     7.0000     8.0000     9.0000
A select
[1 5 1 1]
   Offset: 0
   Strides: [1 1 5 5]
    0.0000     1.0000     2.0000     3.0000     4.0000

Expected behavior (also the workaround behavior) would be that A select is equal to:

    0.0000     2.0000     4.0000     6.0000     8.0000

Arrayfire version:

ArrayFire v3.8.3 (CUDA, 64-bit Linux, build default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants