aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/graph/graph.cc
diff options
context:
space:
mode:
authorGravatar Igor Ganichev <iga@google.com>2017-08-30 21:05:14 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-08-30 21:08:53 -0700
commit9624d165f1f2c717eda96464fee8bf7229cc14f5 (patch)
tree8024d708b58b0c78f19d4c3cfc9f7c4b0c24b70c /tensorflow/core/graph/graph.cc
parent424aa9aa9559f6fa29d8ccf3d74ff25528b39209 (diff)
Add function support to Tensorflow C API
This change adds minimal functionality. Support for FunctionOptions, attributes, output name rewriting, function name generation, etc is comming next. PiperOrigin-RevId: 167091238
Diffstat (limited to 'tensorflow/core/graph/graph.cc')
-rw-r--r--tensorflow/core/graph/graph.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc
index 7d938365c5..a274c79970 100644
--- a/tensorflow/core/graph/graph.cc
+++ b/tensorflow/core/graph/graph.cc
@@ -523,6 +523,17 @@ Status Graph::IsValidNode(const Node* node) const {
return Status::OK();
}
+Status Graph::IsValidOutputTensor(const Node* node, int idx) const {
+ TF_RETURN_IF_ERROR(IsValidNode(node));
+ if (idx >= node->num_outputs()) {
+ return errors::InvalidArgument("Node '", node->name(), "' (type: '",
+ node->op_def().name(),
+ "', num of outputs: ", node->num_outputs(),
+ ") does not have ", "output ", idx);
+ }
+ return Status::OK();
+}
+
Node* Graph::AllocateNode(std::shared_ptr<NodeProperties> props,
const Node* cost_node) {
Node* node = nullptr;
@@ -572,7 +583,7 @@ int Graph::InternDeviceName(const string& device_name) {
}
string Edge::DebugString() const {
- return strings::Printf("Edge %d %s:%d -> %s:%d", id_, src_->name().c_str(),
+ return strings::Printf("[id=%d %s:%d -> %s:%d]", id_, src_->name().c_str(),
src_output_, dst_->name().c_str(), dst_input_);
}