From 6b1d03e940b8bd5caf4d04eb3c1bd1620b863545 Mon Sep 17 00:00:00 2001 From: sunki Date: Fri, 4 Oct 2024 10:13:25 +0900 Subject: [PATCH] [res] Add TFLiteRecipe for dynamic shape StridedSlice This commit adds TFLiteRecipe for dynamic shape StridedSlice. ONE-DCO-1.0-Signed-off-by: sunki --- .../Inf_StridedSlice_000/test.recipe | 47 +++++++++++++++++++ .../Inf_StridedSlice_000/test.rule | 5 ++ .../Inf_StridedSlice_001/test.recipe | 46 ++++++++++++++++++ .../Inf_StridedSlice_001/test.rule | 5 ++ 4 files changed, 103 insertions(+) create mode 100644 res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.recipe create mode 100644 res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.rule create mode 100644 res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.recipe create mode 100644 res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.rule diff --git a/res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.recipe b/res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.recipe new file mode 100644 index 00000000000..9db0593c066 --- /dev/null +++ b/res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.recipe @@ -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" diff --git a/res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.rule b/res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.rule new file mode 100644 index 00000000000..4394ee9cd95 --- /dev/null +++ b/res/TensorFlowLiteRecipes/Inf_StridedSlice_000/test.rule @@ -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] diff --git a/res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.recipe b/res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.recipe new file mode 100644 index 00000000000..025d7a95de1 --- /dev/null +++ b/res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.recipe @@ -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" diff --git a/res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.rule b/res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.rule new file mode 100644 index 00000000000..05083a6bc21 --- /dev/null +++ b/res/TensorFlowLiteRecipes/Inf_StridedSlice_001/test.rule @@ -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]