aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
diff options
context:
space:
mode:
authorGravatar Eugene Brevdo <ebrevdo@google.com>2018-10-10 08:36:36 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-10 08:40:03 -0700
commit79af30d357fbe0869e163e1d9dce0cb869b3724f (patch)
treeaa4789c0aa0e10321afe4d3d84eae5fd0e84af3a /tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
parent131f6f8429ffa0511a3d5a6a595843d3d96ec942 (diff)
[Grappler] Add RemoveStackStridedSliceSameAxis optimizer.
// Replace operations of the form: // x = stack((a_0, a_1, ..., a_{n-1}), axis=k)[:,...,i,...] // with // a_i // when the strided slice index `i` is applied in the k'th axis. // // Similarly, replace operations of the form: // x = stack((a_0, a_1, ..., a_{n-1}), axis=k)[:,...,i:i+1,...] // with // expand_dims(a_i, axis=k) // PiperOrigin-RevId: 216535346
Diffstat (limited to 'tensorflow/core/grappler/optimizers/arithmetic_optimizer.h')
-rw-r--r--tensorflow/core/grappler/optimizers/arithmetic_optimizer.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
index d457eb6d21..bb56f61e30 100644
--- a/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
+++ b/tensorflow/core/grappler/optimizers/arithmetic_optimizer.h
@@ -20,6 +20,7 @@ limitations under the License.
#include "tensorflow/core/grappler/costs/graph_properties.h"
#include "tensorflow/core/grappler/optimizers/graph_optimizer.h"
#include "tensorflow/core/grappler/utils.h"
+#include "tensorflow/core/lib/gtl/flatset.h"
#include "tensorflow/core/protobuf/rewriter_config.pb.h"
namespace tensorflow {
@@ -79,6 +80,7 @@ class ArithmeticOptimizer : public GraphOptimizer {
bool convert_log1p = true;
bool convert_expm1 = true;
bool unary_ops_composition = true;
+ bool remove_stack_strided_slice_same_axis = false;
// Choose which arithmetic optimizer stages will be enabled for a given
// optimization level by default.
@@ -128,6 +130,7 @@ class ArithmeticOptimizer : public GraphOptimizer {
std::unique_ptr<NodeMap> node_map_;
std::unique_ptr<GraphProperties> graph_properties_;
GraphDef* optimized_graph_ = nullptr; // Not owned.
+ gtl::FlatSet<string> feed_nodes_;
};
} // end namespace grappler