From 83b6e1174851956320db6e3566de5da31ff2054a Mon Sep 17 00:00:00 2001 From: Seok Namkoong Date: Thu, 10 Sep 2020 16:06:19 +0900 Subject: [PATCH] [release/1.9.0][bcq-tools] Modify unique value generator (#4174) If `new_shape` attribute of `Reshape` operation is `[1, -1]`, preserved `do_w_x` can be duplicated with it and it can cause unintended conversion. This commit will fix it by modifying the starting value to -1500000001, which is prime number. ONE-DCO-1.0-Signed-off-by: Seok NamKoong --- compiler/bcq-tools/preserve_bcq_info | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/bcq-tools/preserve_bcq_info b/compiler/bcq-tools/preserve_bcq_info index 2ede8d4..f684f84 100644 --- a/compiler/bcq-tools/preserve_bcq_info +++ b/compiler/bcq-tools/preserve_bcq_info @@ -45,15 +45,19 @@ def load_graph(frozen_graph_filename): def preserve_bcq_info(flags): """ - Generate unique dummy value from -1 to -N. + Generate unique dummy value from -1500000001 to -1500000002, + -1500000003, ..., etc. We use negative values to preserve BCQ information because positive values may cause some confusion with real BCQ information values. + In addition, the unique value is started from -1500000001 to + prevent another duplication. For example, if we start from -1 and if + new_shape attribute of Reshape operation is [1, -1], it can be duplicated. """ class UniqueValueGen: def __init__(self): - self.unique_value = -1 + self.unique_value = -1500000001 def gen(self): val = self.unique_value -- 2.7.4