From a077481f768baf1def5fc961603d662a1f4359eb Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Fri, 16 Feb 2024 12:53:49 +0900 Subject: [PATCH] [circle2circle] Add remove_gather_guard option (#12644) This will add remove_gather_guard to remove Gather guard ops. ONE-DCO-1.0-Signed-off-by: SaeHie Park --- compiler/circle2circle/src/Circle2Circle.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/circle2circle/src/Circle2Circle.cpp b/compiler/circle2circle/src/Circle2Circle.cpp index 6699b60b504..5fb163c87a7 100644 --- a/compiler/circle2circle/src/Circle2Circle.cpp +++ b/compiler/circle2circle/src/Circle2Circle.cpp @@ -124,6 +124,9 @@ int entry(int argc, char **argv) add_switch(arser, "--fuse_gelu", "This will fuse operators to GeLU operator"); add_switch(arser, "--remove_duplicate_const", "This will remove all duplicate constant nodes"); add_switch(arser, "--remove_fakequant", "This will remove FakeQuant operators"); + add_switch(arser, "--remove_gather_guard", + "This will remove Add/FloorMod guards of Gather indices with certain conditions. " + "CAUTION: user must guarantee that indices are all non-negative values."); add_switch(arser, "--remove_quantdequant", "This will remove Quantize-Dequantize sequence"); add_switch(arser, "--remove_redundant_quantize", "This will remove redundant Quantize operators"); add_switch(arser, "--remove_redundant_reshape", @@ -312,6 +315,8 @@ int entry(int argc, char **argv) options->enable(Algorithms::RemoveDuplicateConst); if (arser.get("--remove_fakequant")) options->enable(Algorithms::RemoveFakeQuant); + if (arser.get("--remove_gather_guard")) + options->enable(Algorithms::RemoveGatherGuard); if (arser.get("--remove_quantdequant")) options->enable(Algorithms::RemoveQuantDequantSeq); if (arser.get("--remove_redundant_quantize"))