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 TensorFlowLiteRecipes for broadcast Add #14570

Merged
merged 1 commit into from
Jan 21, 2025
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
32 changes: 32 additions & 0 deletions res/TensorFlowLiteRecipes/Add_007/test.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
operand {
name: "ifm1"
type: FLOAT32
shape { dim: 2 dim: 2 dim: 2 dim: 3 }
}
operand {
name: "ifm2"
type: FLOAT32
shape { dim: 1 dim: 2 dim: 2 dim: 3 }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add_003-006 includes examples broadcasting of last dimension.

Here, I add first-mid dimension broadcasting examples.

Add_007: broadcast to dim 0

filler {
tag: "explicit"
arg: "1" arg: "2" arg: "-3" arg: "-1"
arg: "1" arg: "2" arg: "-3" arg: "-1"
arg: "1" arg: "2" arg: "-3" arg: "-1"
}
}
operand {
name: "ofm"
type: FLOAT32
shape { dim: 2 dim: 2 dim: 2 dim: 3 }
}
operation {
type: "Add"
input: "ifm1"
input: "ifm2"
output: "ofm"
add_options {
activation: NONE
}
}
input: "ifm1"
output: "ofm"
Empty file.
32 changes: 32 additions & 0 deletions res/TensorFlowLiteRecipes/Add_008/test.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
operand {
name: "ifm1"
type: FLOAT32
shape { dim: 4 dim: 2 dim: 3 }
}
operand {
name: "ifm2"
type: FLOAT32
shape { dim: 1 dim: 2 dim: 3 }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Broadcast to dim 0, with rank 3

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, in ONE/compiler/luci and related, rank is used for number of dimensions,
so here IIUC rank 3 can be expressed as size 3

filler {
tag: "explicit"
arg: "1" arg: "2"
arg: "3" arg: "4"
arg: "-3" arg: "-1"
}
}
operand {
name: "ofm"
type: FLOAT32
shape { dim: 4 dim: 2 dim: 3 }
}
operation {
type: "Add"
input: "ifm1"
input: "ifm2"
output: "ofm"
add_options {
activation: NONE
}
}
input: "ifm1"
output: "ofm"
Empty file.
32 changes: 32 additions & 0 deletions res/TensorFlowLiteRecipes/Add_009/test.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
operand {
name: "ifm1"
type: FLOAT32
shape { dim: 4 dim: 2 dim: 3 }
}
operand {
name: "ifm2"
type: FLOAT32
shape { dim: 4 dim: 1 dim: 3 }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Broadcast to dim 1, with rank 3

filler {
tag: "explicit"
arg: "1" arg: "2" arg: "1" arg: "2"
arg: "3" arg: "4" arg: "-5" arg: "-6"
arg: "7" arg: "12" arg: "-12" arg: "-2"
}
}
operand {
name: "ofm"
type: FLOAT32
shape { dim: 4 dim: 2 dim: 3 }
}
operation {
type: "Add"
input: "ifm1"
input: "ifm2"
output: "ofm"
add_options {
activation: NONE
}
}
input: "ifm1"
output: "ofm"
Empty file.