Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[res] Add TFLiteRecipe for dynamic shape pad #14109

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions res/TensorFlowLiteRecipes/Inf_Pad_000/test.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# padding with dynamic shape, others same as Pad_000
operand {
name: "ifm"
type: FLOAT32
shape { dim: 1 dim: 1 dim: 3 dim: 2 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious,
Is there any special reason to set the second dim to 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, Is there any special reason to set the second dim to 1?

There is no particular reason. I just wanted to check if rule-lib.sh works well in dims other than the first one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, Is there any special reason to set the second dim to 1?

Oh, I misunderstand your question. 😂

I referred this code for shape_signature to test second dim to dynamic.

shape { dim: 1 dim: 3 dim: 3 dim: 2 }
shape_signature { dim: -1 dim: 3 dim: 3 dim: 2 }

shape_signature { dim: 1 dim: -1 dim: 3 dim: 2 }
}
operand {
name: "padding"
type: INT32
shape { dim: 4 dim: 2 }
filler {
tag: "explicit"
arg: "0" arg: "0"
arg: "1" arg: "1"
arg: "2" arg: "2"
arg: "0" arg: "0"
}
}
operand {
name: "ofm"
type: FLOAT32
shape { dim: 1 dim: 1 dim: 7 dim: 2 }
shape_signature { dim: 1 dim: -1 dim: 7 dim: 2 }
}
operation {
type: "Pad"
input: "ifm"
input: "padding"
output: "ofm"
}
input: "ifm"
output: "ofm"
5 changes: 5 additions & 0 deletions res/TensorFlowLiteRecipes/Inf_Pad_000/test.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To check if dynamic dimension properly inferred

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

RULE "PAD_SHAPE" $(tensor_shape ofm) '=' [1,-1,7,2]