Skip to content

Commit

Permalink
Fixing bug with 0 sized tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
coreylowman committed Aug 10, 2023
1 parent bd6b368 commit 33f7154
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tensor/cpu/iterate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ impl<S: Shape> NdIndex<S> {
indices: Default::default(),
shape: shape.concrete(),
strides,
next: Some(0),
next: if shape.num_elements() > 0 {
Some(0)
} else {
None
},
contiguous: (strides == shape.strides()).then(|| shape.num_elements()),
}
}
Expand Down

0 comments on commit 33f7154

Please sign in to comment.