Skip to content

Commit 1eae6f6

Browse files
selection: handle dim mismatch in reify_view (refinement) (#501)
Summary: Pull Request resolved: #501 if the view matches the base in dimensionality but not extents, fall back on `of_ranks`. addresses comment in D78035345: https://www.internalfb.com/diff/D78035345?dst_version_fbid=1811944813013520&transaction_fbid=1009940194342925. Reviewed By: mariusae Differential Revision: D78111264 fbshipit-source-id: 7790793e4df205410798dc82ea3b8cced9e854f0
1 parent 48123bb commit 1eae6f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ndslice/src/selection.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,9 @@ impl ReifyView for Slice {
10471047
return Ok(dsl::false_());
10481048
}
10491049

1050-
if view.num_dim() != self.num_dim() {
1050+
if view.num_dim() != self.num_dim()
1051+
|| view.sizes().iter().zip(self.sizes()).any(|(&v, &s)| v > s)
1052+
{
10511053
return Selection::of_ranks(self, &view.iter().collect::<BTreeSet<usize>>());
10521054
}
10531055

0 commit comments

Comments
 (0)