Skip to content

Commit 1a5a253

Browse files
yufengleeRyanUnderhill
authored andcommitted
Only fuse when output count of add is 1
1 parent 5ecabe1 commit 1a5a253

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

onnxruntime/core/optimizer/skip_layer_norm_fusion.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ static bool IsSupportedDataType(const Node& node) {
2525

2626
static bool CheckFirstAdd(Node& add, ProviderType providertype) {
2727
if (providertype != add.GetExecutionProviderType() ||
28-
!IsSupportedDataType(add)) {
28+
!IsSupportedDataType(add) ||
29+
add.GetOutputEdgesCount() != 1) {
2930
return false;
3031
}
3132

@@ -58,7 +59,8 @@ static bool CheckFirstAdd(Node& add, ProviderType providertype) {
5859
// The 2nd input should be a 1D constant value
5960
static bool CheckSecondAdd(Node& add, ProviderType providertype) {
6061
if (providertype != add.GetExecutionProviderType() ||
61-
!IsSupportedDataType(add)) {
62+
!IsSupportedDataType(add) ||
63+
add.GetOutputEdgesCount() != 1) {
6264
return false;
6365
}
6466

0 commit comments

Comments
 (0)