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

Slice bug on LibTorch backend #1055

Closed
wcshds opened this issue Dec 7, 2023 · 4 comments · Fixed by #1064
Closed

Slice bug on LibTorch backend #1055

wcshds opened this issue Dec 7, 2023 · 4 comments · Fixed by #1064
Assignees
Labels
bug Something isn't working

Comments

@wcshds
Copy link
Contributor

wcshds commented Dec 7, 2023

Here is the code.

type Backend = LibTorch;

let tensor = Tensor::<Backend, 1, Int>::from_data([1, 2, 3, 4, 5]);
let tensor = tensor
    .clone()
    .slice([0..3])
    .equal(tensor.clone().slice([2..5]));
println!("{}", tensor);

Sometimes it panics.
image

@antimora antimora added the bug Something isn't working label Dec 8, 2023
@wcshds
Copy link
Contributor Author

wcshds commented Dec 11, 2023

It seems that calling the clone() again after the second slice() could serve as a temporary workaround for this issue.

type Backend = LibTorch;

let tensor = Tensor::<Backend, 1, Int>::from_data([1, 2, 3, 4, 5]);
let tensor = tensor
    .clone()
    .slice([0..3])
    .equal(tensor.clone().slice([2..5]).clone());
println!("{}", tensor);

wcshds added a commit to wcshds/burn that referenced this issue Dec 11, 2023
@nathanielsimard nathanielsimard self-assigned this Dec 12, 2023
@nathanielsimard
Copy link
Member

I'm gonna work on this, it's probably at the source of some data corruption we have #877

@nathanielsimard
Copy link
Member

@wcshds added the fix, can you validate if it works with your model?

@wcshds
Copy link
Contributor Author

wcshds commented Dec 12, 2023

@nathanielsimard Thank you! Now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants