aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-12-13 15:13:16 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-12-13 15:16:46 -0800
commitb09be8eff9505486b0f838e2cb281c3ebe8ecfc6 (patch)
tree690468bf4d20a45ca6db4dacbd7ae5b14d99dc70
parent828dfee507623c9b8496904e7b94beb9c6ca8306 (diff)
Enable Div -> Mul by reciprocal strength reduction.
PiperOrigin-RevId: 178965261
-rw-r--r--tensorflow/core/grappler/optimizers/constant_folding.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/tensorflow/core/grappler/optimizers/constant_folding.cc b/tensorflow/core/grappler/optimizers/constant_folding.cc
index fa3039d3f6..007e3161f1 100644
--- a/tensorflow/core/grappler/optimizers/constant_folding.cc
+++ b/tensorflow/core/grappler/optimizers/constant_folding.cc
@@ -1433,8 +1433,7 @@ Status ConstantFolding::SimplifyGraph(GraphDef* output,
// Strength reduce floating point division by a constant Div(x, const) to
// multiplication by the reciprocal Mul(x, Reciprocal(const)). This in turn
// will be constant folded to Mul(x, 1.0/const).
- if (is_aggressive && node->input_size() >= 2 &&
- (IsRealDiv(*node) || IsDiv(*node))) {
+ if (node->input_size() >= 2 && (IsRealDiv(*node) || IsDiv(*node))) {
const string& const_input = node->input(1);
const NodeDef* denom = node_map_->GetNode(const_input);
CHECK(denom != nullptr);