Skip to content

Commit

Permalink
[res] Add TFLiteRecipe for dynamic shape StridedSlice (#14156)
Browse files Browse the repository at this point in the history
This commit adds TFLiteRecipe for dynamic shape StridedSlice.

ONE-DCO-1.0-Signed-off-by: sunki <[email protected]>
  • Loading branch information
qsunki authored Oct 7, 2024
1 parent 4b03e7a commit ad1d197
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
47 changes: 47 additions & 0 deletions res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
operand {
name: "ifm"
type: FLOAT32
shape { dim: 1 dim: 0 dim: 0 dim: 5 }
shape_signature { dim: 1 dim: -1 dim: -1 dim: 5 }
}
operand {
name: "begin"
type: INT32
shape { dim: 4 }
filler { tag: "explicit" arg: "0" arg: "0" arg: "0" arg: "0" }
}
operand {
name: "end"
type: INT32
shape { dim: 4 }
filler { tag: "explicit" arg: "1" arg: "8" arg: "3" arg: "5" }
}
operand {
name: "strides"
type: INT32
shape { dim: 4 }
filler { tag: "explicit" arg: "1" arg: "1" arg: "1" arg: "1" }
}
operand {
name: "ofm"
type: FLOAT32
shape { dim: 1 dim: 0 dim: 0 dim: 5 }
shape_signature { dim: 1 dim: -1 dim: -1 dim: 5 }
}
operation {
type: "StridedSlice"
input: "ifm"
input: "begin"
input: "end"
input: "strides"
output: "ofm"
strided_slice_options {
begin_mask: 0
end_mask: 0
ellipsis_mask: 0
new_axis_mask: 0
shrink_axis_mask: 0
}
}
input: "ifm"
output: "ofm"
5 changes: 5 additions & 0 deletions res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To check if dynamic dimension properly inferred if input has dynamic shape

RULE "VERIFY_FILE_FORMAT" $(verify_file_format) '=' 1

RULE "STRIDED_SLICE_SHAPE" $(tensor_shape ofm) '=' [1,-1,-1,5]
46 changes: 46 additions & 0 deletions res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
operand {
name: "ifm"
type: FLOAT32
shape { dim: 1 dim: 8 dim: 3 dim: 5 }
}
operand {
name: "begin"
type: INT32
shape { dim: 4 }
}
operand {
name: "end"
type: INT32
shape { dim: 4 }
filler { tag: "explicit" arg: "1" arg: "8" arg: "3" arg: "5" }
}
operand {
name: "strides"
type: INT32
shape { dim: 4 }
filler { tag: "explicit" arg: "1" arg: "1" arg: "1" arg: "1" }
}
operand {
name: "ofm"
type: FLOAT32
shape { dim: 0 dim: 0 dim: 0 dim: 0 }
shape_signature { dim: -1 dim: -1 dim: -1 dim: -1 }
}
operation {
type: "StridedSlice"
input: "ifm"
input: "begin"
input: "end"
input: "strides"
output: "ofm"
strided_slice_options {
begin_mask: 0
end_mask: 0
ellipsis_mask: 0
new_axis_mask: 0
shrink_axis_mask: 0
}
}
input: "ifm"
input: "begin"
output: "ofm"
5 changes: 5 additions & 0 deletions res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To check if dynamic dimension properly inferred if begin is non-const

RULE "VERIFY_FILE_FORMAT" $(verify_file_format) '=' 1

RULE "STRIDED_SLICE_SHAPE" $(tensor_shape ofm) '=' [-1,-1,-1,-1]

0 comments on commit ad1d197

Please sign in to comment.