diff --git a/compiler/luci/pass/src/FuseAddWithTConvPass.cpp b/compiler/luci/pass/src/FuseAddWithTConvPass.cpp index 7032e6927b3..3563aa8fe52 100644 --- a/compiler/luci/pass/src/FuseAddWithTConvPass.cpp +++ b/compiler/luci/pass/src/FuseAddWithTConvPass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2024 Samsung Electronics Co., Ltd. All Rights Reserved + * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,9 +51,9 @@ namespace */ bool fuse_add_with_tconv(luci::CircleAdd *add) { - // Allow Add node only with FLOAT32 data type: + // Allow Add node only with FLOAT32 data type. RETURN_FALSE_UNLESS(add->dtype() == loco::DataType::FLOAT32); - + // Allow Add node only with specific activations. RETURN_FALSE_UNLESS(add->fusedActivationFunction() == luci::FusedActFunc::NONE || add->fusedActivationFunction() == luci::FusedActFunc::RELU6 || add->fusedActivationFunction() == luci::FusedActFunc::RELU); @@ -88,34 +88,35 @@ bool fuse_add_with_tconv(luci::CircleAdd *add) { auto name = addition->name(); assert(name.length() > 0); - // separate relu op from add op + // Separate relu op from add op: auto relu = add->graph()->nodes()->create(); relu->features(tconv); relu->name(name + "/Relu6"); luci::add_origin(relu, luci::get_origin(add)); - // remove add node + // Remove add node. replace(add).with(relu); } else if (add->fusedActivationFunction() == luci::FusedActFunc::RELU) { auto name = addition->name(); assert(name.length() > 0); - // separate relu op from add op + // Separate relu op from add op: auto relu = add->graph()->nodes()->create(); relu->features(tconv); relu->name(name + "/Relu"); luci::add_origin(relu, luci::get_origin(add)); - // remove add node + // Remove add node. replace(add).with(relu); } else { + // Remove add node. replace(add).with(tconv); } - // set origin + // Set new origin. luci::add_origin(tconv, luci::get_origin(add)); return true; diff --git a/compiler/luci/pass/src/FuseAddWithTConvPass.test.cpp b/compiler/luci/pass/src/FuseAddWithTConvPass.test.cpp index eede887ad95..3bf7d112aa2 100644 --- a/compiler/luci/pass/src/FuseAddWithTConvPass.test.cpp +++ b/compiler/luci/pass/src/FuseAddWithTConvPass.test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Samsung Electronics Co., Ltd. All Rights Reserved + * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.