aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-01-05 14:38:01 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-05 14:45:43 -0800
commiteaf0f8c1dab91af10c3c63385e953dd2917c0da0 (patch)
treebc447798fa1a4a89a353f71c02f81480cfd98664
parent93ee6cc577d6d82f996777affcbf439278cd6871 (diff)
Clarify in comments what the source of truth is for a Node's inputs.
Change: 143710475
-rw-r--r--tensorflow/core/graph/graph.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/tensorflow/core/graph/graph.h b/tensorflow/core/graph/graph.h
index 7f4e365ca4..24e38c6b1f 100644
--- a/tensorflow/core/graph/graph.h
+++ b/tensorflow/core/graph/graph.h
@@ -70,6 +70,15 @@ class Node {
int cost_id() const { return cost_id_; }
const string& name() const { return props_->node_def_.name(); }
const string& type_string() const { return props_->node_def_.op(); }
+ // def() provides the NodeDef the user supplied, but the specifics
+ // of this Node may have changed due to placement, optimization, etc.
+ // In particular:
+ // * def().name() will match name();
+ // * def().op() will match type_string() and op_def().name();
+ // * def().input() is not reliable, use "in_edges()" below instead;
+ // * def().device() is the "user's requested device" and may not match
+ // the actual assigned device, see assigned_device_name() below;
+ // * def().attr() is authoritative.
const NodeDef& def() const { return props_->node_def_; }
const OpDef& op_def() const { return *props_->op_def_; }
@@ -86,8 +95,8 @@ class Node {
// you want the device the user requested, use def().device() instead.
// TODO(josh11b): Validate that the assigned_device, if not empty:
// fully specifies a device, and satisfies def().device().
- // TODO(josh11b): Move device_name outside of Node into a NodeId->DeviceName
- // map.
+ // TODO(josh11b): Move assigned_device_name outside of Node into a
+ // NodeId->DeviceName map.
string assigned_device_name() const { return assigned_device_name_; }
void set_assigned_device_name(const string& device_name) {
assigned_device_name_ = device_name;