tf_1.8_xla_doc
tf2xla_util.h
Go to the documentation of this file.
1 
3 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7  http://www.apache.org/licenses/LICENSE-2.0
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13 ==============================================================================*/
14 #ifndef TENSORFLOW_COMPILER_TF2XLA_TF2XLA_UTIL_H_
15 #define TENSORFLOW_COMPILER_TF2XLA_TF2XLA_UTIL_H_
16 #include <unordered_map>
17 #include "tensorflow/compiler/tf2xla/tf2xla.pb.h"
18 #include "tensorflow/core/framework/graph.pb.h"
19 #include "tensorflow/core/framework/op.h"
20 #include "tensorflow/core/graph/graph.h"
21 #include "tensorflow/core/lib/core/status.h"
22 namespace tensorflow {
23 // ValidateConfig returns OK iff config is valid.
24 Status ValidateConfig(const tf2xla::Config& config);
25 // Modifies <graph_def> to include placeholders for each fed tensor, and
26 // update references to the fed tensors to refer to the placeholders.
27 // The existing nodes referenced by the feeds are not removed or modified
28 // (except where their input edges are modified by the replacement of other
29 // feeds).
31  const tf2xla::Config& config, const OpRegistryInterface* op_registry,
32  std::unordered_map<string, string>* feed_remapping, GraphDef* graph_def);
33 // Returns in <out> a copy of <in>, pruned to only include fetches from
34 // <config>.
35 Status PruneGraphDefInto(const tf2xla::Config& config, const GraphDef& in,
36  GraphDef* out);
37 // Returns node:port for the given <id>.
38 string TensorIdToString(const tf2xla::TensorId& id);
39 // Updates the sharding of <n> based on the sharding of its neighbors.
40 // If <out_edges> is true, outgoing edges from <n> are considered; else incoming
41 // edges are considered.
42 Status SetNodeShardingFromNeighbors(Node* n, bool out_edges);
43 } // namespace tensorflow
44 #endif // TENSORFLOW_COMPILER_TF2XLA_TF2XLA_UTIL_H_
45 
Status AddPlaceholdersForFeeds(const tf2xla::Config &config, const OpRegistryInterface *op_registry, std::unordered_map< string, string > *feed_remapping, GraphDef *graph_def)
Generate corresponding placeholder for each feed tensor. Traverse each inputs of each nodes...
Definition: tf2xla_util.cc:98
Status PruneGraphDefInto(const tf2xla::Config &config, const GraphDef &in, GraphDef *out)
Remove source nodes of feed tensor. Because they are removed at tensorflow::AddPlaceholdersForFeeds ...
Definition: tf2xla_util.cc:190
Definition: compile.cc:35
Status ValidateConfig(const tf2xla::Config &config)
Definition: tf2xla_util.cc:69