Skip to content

Commit

Permalink
constrait modulo and strides
Browse files Browse the repository at this point in the history
  • Loading branch information
kali committed Sep 5, 2023
1 parent 889f82e commit 39eae65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/ops/array/strided_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl StridedSlice {
if preped.stride != 1 {
wire = target.wire_node(
format!("{prefix}.stride-axis-{axis}"),
crate::ops::downsample::Downsample::new(axis, preped.stride as isize),
crate::ops::downsample::Downsample::new(axis, preped.stride as isize, 0),
[wire].as_ref(),
)?[0];
}
Expand Down
1 change: 1 addition & 0 deletions core/src/ops/downsample/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl EvalOp for Downsample {
impl TypedOp for Downsample {
fn output_facts(&self, inputs: &[&TypedFact]) -> TractResult<TVec<TypedFact>> {
ensure!(self.axis < inputs[0].rank());
ensure!(self.modulo == 0 || self.stride > 0, "non-zero modulo is only defined with forward strides");
let mut downed = inputs[0].clone();
let down_len = self.transform_dim(&downed.shape[self.axis]);
downed.shape.set(self.axis, down_len);
Expand Down

0 comments on commit 39eae65

Please sign in to comment.