aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-04-24 13:21:49 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-24 13:24:49 -0700
commit4355b923c273a4e07655f860a95428b2db977741 (patch)
treec714250d587cb5672f59e2ecda107c416254a1d8 /tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
parent893aa776009418c841d49c924207f3cdaf1d5174 (diff)
Implement hoisting of common prefix of unary ops to concat.
PiperOrigin-RevId: 194135148
Diffstat (limited to 'tensorflow/core/grappler/optimizers/arithmetic_optimizer.h')
-rw-r--r--tensorflow/core/grappler/optimizers/arithmetic_optimizer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
index 344c8281eb..375f13acc1 100644
--- a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
+++ b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
@@ -56,6 +56,7 @@ class ArithmeticOptimizer : public GraphOptimizer {
struct ArithmeticOptimizerOptions {
// TODO(ezhulenev): flag do disable TrySimplifyAndReplaceUses in tests.
// Remove when all optimizers will be migrated to separate stages.
+ bool dedup_computations = true;
bool enable_try_simplify_and_replace = true;
bool combine_add_to_addn = true;
bool hoist_common_factor_out_of_aggregation = true;
@@ -64,12 +65,16 @@ class ArithmeticOptimizer : public GraphOptimizer {
bool remove_redundant_bitcast = true;
bool remove_redundant_cast = true;
bool remove_negation = true;
+ bool hoist_unary_out_of_concat = false;
// Choose which arithmetic optimizer stages will be enabled for a given
// optimization level by default.
static ArithmeticOptimizerOptions Default(
RewriterConfig::Toggle opt_level) {
ArithmeticOptimizerOptions options;
+ if (opt_level == RewriterConfig::AGGRESSIVE) {
+ options.hoist_unary_out_of_concat = true;
+ }
return options;
}
};