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

Tile Assignment Check #227

Open
ryanmrichard opened this issue Nov 25, 2020 · 0 comments
Open

Tile Assignment Check #227

ryanmrichard opened this issue Nov 25, 2020 · 0 comments

Comments

@ryanmrichard
Copy link
Contributor

Consider the following code which intends to put the diagonal of a rank 4 tensor into a rank 2 tensor:

auto t4 = makes_a_rank_4_tensor();
auto t2 = makes_uninitialized_rank_2_tensor();
for(auto itr = t2.begin(); itr != t2.end(); ++itr){
    auto ij = itr.index();
    // Bug because user unintentionally copies the range and not just the data
    t2.set(ij, t4.find({ij[0], ij[1], ij[0], ij[1]}));
}

This actually compiles and "works" (the resulting tensor can be printed, but results in errors in most other circumstances since the tensor is rank 2, but has rank 4 tiles). I think set should raise an error in this scenario. Not a pressing issue, but wanted to make a note of it before I forgot.

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