aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/framework
diff options
context:
space:
mode:
authorGravatar Sherry Moore <sherrym@google.com>2017-06-12 11:27:22 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-12 11:30:55 -0700
commit2d1823f7be0d65d4ee28b7c6ea2acaac01f1db61 (patch)
tree9c234b418510121149dfd29fc9580d0e2cc3cc91 /tensorflow/python/framework
parentb4aa475f0375ea3d007fd4c3c95d9e1971a13bfd (diff)
Added proto function for LOCAL_VARIABLES and MODEL_VARIABLES.
PiperOrigin-RevId: 158739297
Diffstat (limited to 'tensorflow/python/framework')
-rw-r--r--tensorflow/python/framework/meta_graph.py13
-rw-r--r--tensorflow/python/framework/meta_graph_test.py58
-rw-r--r--tensorflow/python/framework/testdata/metrics_export_meta_graph.pb1558
3 files changed, 1627 insertions, 2 deletions
diff --git a/tensorflow/python/framework/meta_graph.py b/tensorflow/python/framework/meta_graph.py
index e46c56ddd1..9f4e4a18f2 100644
--- a/tensorflow/python/framework/meta_graph.py
+++ b/tensorflow/python/framework/meta_graph.py
@@ -44,6 +44,11 @@ from tensorflow.python.util import compat
# Prefix to be added to unbound input names so they are easily identifiable.
_UNBOUND_INPUT_PREFIX = "$unbound_inputs_"
+# List of collections that didn't register proto functions, as a result in
+# a previously exported meta_graph the items are of a different data type.
+_COMPAT_COLLECTION_LIST = [ops.GraphKeys.LOCAL_VARIABLES,
+ ops.GraphKeys.MODEL_VARIABLES]
+
def _node_def(from_node_def, export_scope, unbound_inputs, clear_devices=False):
"""Create a `NodeDef` proto with export_scope stripped.
@@ -667,8 +672,7 @@ def import_scoped_meta_graph(meta_graph_or_file,
key)
continue
from_proto = ops.get_from_proto_function(key)
- if from_proto:
- assert kind == "bytes_list"
+ if from_proto and kind == "bytes_list":
proto_type = ops.get_collection_proto_type(key)
for value in col_def.bytes_list.value:
proto = proto_type()
@@ -677,6 +681,11 @@ def import_scoped_meta_graph(meta_graph_or_file,
key, from_proto(proto, import_scope=scope_to_prepend_to_names))
else:
field = getattr(col_def, kind)
+ if key in _COMPAT_COLLECTION_LIST:
+ logging.warning(
+ "The saved meta_graph is possibly from an older release:\n"
+ "'%s' collection should be of type 'byte_list', but instead "
+ "is of type '%s'.", key, kind)
if kind == "node_list":
for value in field.value:
col_op = graph.as_graph_element(
diff --git a/tensorflow/python/framework/meta_graph_test.py b/tensorflow/python/framework/meta_graph_test.py
index 10236576ea..13a92c3c7e 100644
--- a/tensorflow/python/framework/meta_graph_test.py
+++ b/tensorflow/python/framework/meta_graph_test.py
@@ -34,6 +34,7 @@ from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import data_flow_ops
from tensorflow.python.ops import math_ops
+from tensorflow.python.ops import metrics
from tensorflow.python.ops import nn_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops import resource_variable_ops
@@ -599,5 +600,62 @@ class ScopedMetaGraphTest(test.TestCase):
self.assertEqual("", str(graph2.as_graph_element("matmul").device))
+class MetaGraphWithVariableScopeTest(test.TestCase):
+
+ def testMetricsCollection(self):
+
+ def _enqueue_vector(sess, queue, values, shape=None):
+ if not shape:
+ shape = (1, len(values))
+ dtype = queue.dtypes[0]
+ sess.run(
+ queue.enqueue(constant_op.constant(
+ values, dtype=dtype, shape=shape)))
+
+ meta_graph_filename = os.path.join(
+ _TestDir("metrics_export"), "meta_graph.pb")
+
+ graph = ops.Graph()
+ with self.test_session(graph=graph) as sess:
+ values_queue = data_flow_ops.FIFOQueue(
+ 4, dtypes.float32, shapes=(1, 2))
+ _enqueue_vector(sess, values_queue, [0, 1])
+ _enqueue_vector(sess, values_queue, [-4.2, 9.1])
+ _enqueue_vector(sess, values_queue, [6.5, 0])
+ _enqueue_vector(sess, values_queue, [-3.2, 4.0])
+ values = values_queue.dequeue()
+
+ _, update_op = metrics.mean(values)
+
+ initializer = variables.local_variables_initializer()
+ sess.run(initializer)
+ sess.run(update_op)
+
+ meta_graph.export_scoped_meta_graph(
+ filename=meta_graph_filename, graph=graph)
+
+ # Verifies that importing a meta_graph with LOCAL_VARIABLES collection
+ # works correctly.
+ graph = ops.Graph()
+ with self.test_session(graph=graph) as sess:
+ meta_graph.import_scoped_meta_graph(meta_graph_filename)
+ initializer = variables.local_variables_initializer()
+ sess.run(initializer)
+
+ # Verifies that importing an old meta_graph where "local_variables"
+ # collection is of node_list type works, but cannot build initializer
+ # with the collection.
+ graph = ops.Graph()
+ with self.test_session(graph=graph) as sess:
+ meta_graph.import_scoped_meta_graph(
+ test.test_src_dir_path(
+ "python/framework/testdata/metrics_export_meta_graph.pb"))
+ self.assertEqual(len(ops.get_collection(ops.GraphKeys.LOCAL_VARIABLES)),
+ 2)
+ with self.assertRaisesRegexp(
+ AttributeError, "'Tensor' object has no attribute 'initializer'"):
+ initializer = variables.local_variables_initializer()
+
+
if __name__ == "__main__":
test.main()
diff --git a/tensorflow/python/framework/testdata/metrics_export_meta_graph.pb b/tensorflow/python/framework/testdata/metrics_export_meta_graph.pb
new file mode 100644
index 0000000000..fffbe8df2f
--- /dev/null
+++ b/tensorflow/python/framework/testdata/metrics_export_meta_graph.pb
@@ -0,0 +1,1558 @@
+meta_info_def {
+ stripped_op_list {
+ op {
+ name: "Assign"
+ input_arg {
+ name: "ref"
+ type_attr: "T"
+ is_ref: true
+ }
+ input_arg {
+ name: "value"
+ type_attr: "T"
+ }
+ output_arg {
+ name: "output_ref"
+ type_attr: "T"
+ is_ref: true
+ }
+ attr {
+ name: "T"
+ type: "type"
+ }
+ attr {
+ name: "validate_shape"
+ type: "bool"
+ default_value {
+ b: true
+ }
+ }
+ attr {
+ name: "use_locking"
+ type: "bool"
+ default_value {
+ b: true
+ }
+ }
+ allows_uninitialized_input: true
+ }
+ op {
+ name: "AssignAdd"
+ input_arg {
+ name: "ref"
+ type_attr: "T"
+ is_ref: true
+ }
+ input_arg {
+ name: "value"
+ type_attr: "T"
+ }
+ output_arg {
+ name: "output_ref"
+ type_attr: "T"
+ is_ref: true
+ }
+ attr {
+ name: "T"
+ type: "type"
+ allowed_values {
+ list {
+ type: DT_FLOAT
+ type: DT_DOUBLE
+ type: DT_INT64
+ type: DT_INT32
+ type: DT_UINT8
+ type: DT_UINT16
+ type: DT_INT16
+ type: DT_INT8
+ type: DT_COMPLEX64
+ type: DT_COMPLEX128
+ type: DT_QINT8
+ type: DT_QUINT8
+ type: DT_QINT32
+ type: DT_HALF
+ }
+ }
+ }
+ attr {
+ name: "use_locking"
+ type: "bool"
+ default_value {
+ b: false
+ }
+ }
+ }
+ op {
+ name: "Cast"
+ input_arg {
+ name: "x"
+ type_attr: "SrcT"
+ }
+ output_arg {
+ name: "y"
+ type_attr: "DstT"
+ }
+ attr {
+ name: "SrcT"
+ type: "type"
+ }
+ attr {
+ name: "DstT"
+ type: "type"
+ }
+ }
+ op {
+ name: "Const"
+ output_arg {
+ name: "output"
+ type_attr: "dtype"
+ }
+ attr {
+ name: "value"
+ type: "tensor"
+ }
+ attr {
+ name: "dtype"
+ type: "type"
+ }
+ }
+ op {
+ name: "FIFOQueueV2"
+ output_arg {
+ name: "handle"
+ type: DT_RESOURCE
+ }
+ attr {
+ name: "component_types"
+ type: "list(type)"
+ has_minimum: true
+ minimum: 1
+ }
+ attr {
+ name: "shapes"
+ type: "list(shape)"
+ default_value {
+ list {
+ }
+ }
+ has_minimum: true
+ }
+ attr {
+ name: "capacity"
+ type: "int"
+ default_value {
+ i: -1
+ }
+ }
+ attr {
+ name: "container"
+ type: "string"
+ default_value {
+ s: ""
+ }
+ }
+ attr {
+ name: "shared_name"
+ type: "string"
+ default_value {
+ s: ""
+ }
+ }
+ is_stateful: true
+ }
+ op {
+ name: "Greater"
+ input_arg {
+ name: "x"
+ type_attr: "T"
+ }
+ input_arg {
+ name: "y"
+ type_attr: "T"
+ }
+ output_arg {
+ name: "z"
+ type: DT_BOOL
+ }
+ attr {
+ name: "T"
+ type: "type"
+ allowed_values {
+ list {
+ type: DT_FLOAT
+ type: DT_DOUBLE
+ type: DT_INT32
+ type: DT_INT64
+ type: DT_UINT8
+ type: DT_INT16
+ type: DT_INT8
+ type: DT_UINT16
+ type: DT_HALF
+ }
+ }
+ }
+ }
+ op {
+ name: "Identity"
+ input_arg {
+ name: "input"
+ type_attr: "T"
+ }
+ output_arg {
+ name: "output"
+ type_attr: "T"
+ }
+ attr {
+ name: "T"
+ type: "type"
+ }
+ }
+ op {
+ name: "NoOp"
+ }
+ op {
+ name: "QueueDequeueV2"
+ input_arg {
+ name: "handle"
+ type: DT_RESOURCE
+ }
+ output_arg {
+ name: "components"
+ type_list_attr: "component_types"
+ }
+ attr {
+ name: "component_types"
+ type: "list(type)"
+ has_minimum: true
+ minimum: 1
+ }
+ attr {
+ name: "timeout_ms"
+ type: "int"
+ default_value {
+ i: -1
+ }
+ }
+ is_stateful: true
+ }
+ op {
+ name: "QueueEnqueueV2"
+ input_arg {
+ name: "handle"
+ type: DT_RESOURCE
+ }
+ input_arg {
+ name: "components"
+ type_list_attr: "Tcomponents"
+ }
+ attr {
+ name: "Tcomponents"
+ type: "list(type)"
+ has_minimum: true
+ minimum: 1
+ }
+ attr {
+ name: "timeout_ms"
+ type: "int"
+ default_value {
+ i: -1
+ }
+ }
+ is_stateful: true
+ }
+ op {
+ name: "RealDiv"
+ input_arg {
+ name: "x"
+ type_attr: "T"
+ }
+ input_arg {
+ name: "y"
+ type_attr: "T"
+ }
+ output_arg {
+ name: "z"
+ type_attr: "T"
+ }
+ attr {
+ name: "T"
+ type: "type"
+ allowed_values {
+ list {
+ type: DT_HALF
+ type: DT_FLOAT
+ type: DT_DOUBLE
+ type: DT_UINT8
+ type: DT_INT8
+ type: DT_UINT16
+ type: DT_INT16
+ type: DT_INT32
+ type: DT_INT64
+ type: DT_COMPLEX64
+ type: DT_COMPLEX128
+ }
+ }
+ }
+ }
+ op {
+ name: "Select"
+ input_arg {
+ name: "condition"
+ type: DT_BOOL
+ }
+ input_arg {
+ name: "t"
+ type_attr: "T"
+ }
+ input_arg {
+ name: "e"
+ type_attr: "T"
+ }
+ output_arg {
+ name: "output"
+ type_attr: "T"
+ }
+ attr {
+ name: "T"
+ type: "type"
+ }
+ }
+ op {
+ name: "Sum"
+ input_arg {
+ name: "input"
+ type_attr: "T"
+ }
+ input_arg {
+ name: "reduction_indices"
+ type_attr: "Tidx"
+ }
+ output_arg {
+ name: "output"
+ type_attr: "T"
+ }
+ attr {
+ name: "keep_dims"
+ type: "bool"
+ default_value {
+ b: false
+ }
+ }
+ attr {
+ name: "T"
+ type: "type"
+ allowed_values {
+ list {
+ type: DT_FLOAT
+ type: DT_DOUBLE
+ type: DT_INT64
+ type: DT_INT32
+ type: DT_UINT8
+ type: DT_UINT16
+ type: DT_INT16
+ type: DT_INT8
+ type: DT_COMPLEX64
+ type: DT_COMPLEX128
+ type: DT_QINT8
+ type: DT_QUINT8
+ type: DT_QINT32
+ type: DT_HALF
+ }
+ }
+ }
+ attr {
+ name: "Tidx"
+ type: "type"
+ default_value {
+ type: DT_INT32
+ }
+ allowed_values {
+ list {
+ type: DT_INT32
+ type: DT_INT64
+ }
+ }
+ }
+ }
+ op {
+ name: "VariableV2"
+ output_arg {
+ name: "ref"
+ type_attr: "dtype"
+ is_ref: true
+ }
+ attr {
+ name: "shape"
+ type: "shape"
+ }
+ attr {
+ name: "dtype"
+ type: "type"
+ }
+ attr {
+ name: "container"
+ type: "string"
+ default_value {
+ s: ""
+ }
+ }
+ attr {
+ name: "shared_name"
+ type: "string"
+ default_value {
+ s: ""
+ }
+ }
+ is_stateful: true
+ }
+ }
+ tensorflow_version: "1.1.0-rc2"
+ tensorflow_git_version: "unknown"
+}
+graph_def {
+ node {
+ name: "fifo_queue"
+ op: "FIFOQueueV2"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "capacity"
+ value {
+ i: 4
+ }
+ }
+ attr {
+ key: "component_types"
+ value {
+ list {
+ type: DT_FLOAT
+ }
+ }
+ }
+ attr {
+ key: "container"
+ value {
+ s: ""
+ }
+ }
+ attr {
+ key: "shapes"
+ value {
+ list {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+ }
+ attr {
+ key: "shared_name"
+ value {
+ s: ""
+ }
+ }
+ }
+ node {
+ name: "Const"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ tensor_content: "\000\000\000\000\000\000\200?"
+ }
+ }
+ }
+ }
+ node {
+ name: "fifo_queue_enqueue"
+ op: "QueueEnqueueV2"
+ input: "fifo_queue"
+ input: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "Tcomponents"
+ value {
+ list {
+ type: DT_FLOAT
+ }
+ }
+ }
+ attr {
+ key: "timeout_ms"
+ value {
+ i: -1
+ }
+ }
+ }
+ node {
+ name: "Const_1"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ tensor_content: "ff\206\300\232\231\021A"
+ }
+ }
+ }
+ }
+ node {
+ name: "fifo_queue_enqueue_1"
+ op: "QueueEnqueueV2"
+ input: "fifo_queue"
+ input: "Const_1"
+ device: "/device:CPU:0"
+ attr {
+ key: "Tcomponents"
+ value {
+ list {
+ type: DT_FLOAT
+ }
+ }
+ }
+ attr {
+ key: "timeout_ms"
+ value {
+ i: -1
+ }
+ }
+ }
+ node {
+ name: "Const_2"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ tensor_content: "\000\000\320@\000\000\000\000"
+ }
+ }
+ }
+ }
+ node {
+ name: "fifo_queue_enqueue_2"
+ op: "QueueEnqueueV2"
+ input: "fifo_queue"
+ input: "Const_2"
+ device: "/device:CPU:0"
+ attr {
+ key: "Tcomponents"
+ value {
+ list {
+ type: DT_FLOAT
+ }
+ }
+ }
+ attr {
+ key: "timeout_ms"
+ value {
+ i: -1
+ }
+ }
+ }
+ node {
+ name: "Const_3"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ tensor_content: "\315\314L\300\000\000\200@"
+ }
+ }
+ }
+ }
+ node {
+ name: "fifo_queue_enqueue_3"
+ op: "QueueEnqueueV2"
+ input: "fifo_queue"
+ input: "Const_3"
+ device: "/device:CPU:0"
+ attr {
+ key: "Tcomponents"
+ value {
+ list {
+ type: DT_FLOAT
+ }
+ }
+ }
+ attr {
+ key: "timeout_ms"
+ value {
+ i: -1
+ }
+ }
+ }
+ node {
+ name: "fifo_queue_Dequeue"
+ op: "QueueDequeueV2"
+ input: "fifo_queue"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+ }
+ attr {
+ key: "component_types"
+ value {
+ list {
+ type: DT_FLOAT
+ }
+ }
+ }
+ attr {
+ key: "timeout_ms"
+ value {
+ i: -1
+ }
+ }
+ }
+ node {
+ name: "mean/total/Initializer/zeros"
+ op: "Const"
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/total"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ }
+ float_val: 0.0
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/total"
+ op: "VariableV2"
+ device: "/device:CPU:0"
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/total"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "container"
+ value {
+ s: ""
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ }
+ }
+ }
+ attr {
+ key: "shared_name"
+ value {
+ s: ""
+ }
+ }
+ }
+ node {
+ name: "mean/total/Assign"
+ op: "Assign"
+ input: "mean/total"
+ input: "mean/total/Initializer/zeros"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/total"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "use_locking"
+ value {
+ b: true
+ }
+ }
+ attr {
+ key: "validate_shape"
+ value {
+ b: true
+ }
+ }
+ }
+ node {
+ name: "mean/total/read"
+ op: "Identity"
+ input: "mean/total"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/total"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/count/Initializer/zeros"
+ op: "Const"
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/count"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ }
+ float_val: 0.0
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/count"
+ op: "VariableV2"
+ device: "/device:CPU:0"
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/count"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "container"
+ value {
+ s: ""
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ }
+ }
+ }
+ attr {
+ key: "shared_name"
+ value {
+ s: ""
+ }
+ }
+ }
+ node {
+ name: "mean/count/Assign"
+ op: "Assign"
+ input: "mean/count"
+ input: "mean/count/Initializer/zeros"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/count"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "use_locking"
+ value {
+ b: true
+ }
+ }
+ attr {
+ key: "validate_shape"
+ value {
+ b: true
+ }
+ }
+ }
+ node {
+ name: "mean/count/read"
+ op: "Identity"
+ input: "mean/count"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/count"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/Size"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_INT32
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape {
+ }
+ int_val: 2
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/ToFloat_1"
+ op: "Cast"
+ input: "mean/Size"
+ device: "/device:CPU:0"
+ attr {
+ key: "DstT"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "SrcT"
+ value {
+ type: DT_INT32
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/Const"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_INT32
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ tensor_content: "\000\000\000\000\001\000\000\000"
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/Sum"
+ op: "Sum"
+ input: "fifo_queue_Dequeue"
+ input: "mean/Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "Tidx"
+ value {
+ type: DT_INT32
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "keep_dims"
+ value {
+ b: false
+ }
+ }
+ }
+ node {
+ name: "mean/AssignAdd"
+ op: "AssignAdd"
+ input: "mean/total"
+ input: "mean/Sum"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/total"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "use_locking"
+ value {
+ b: false
+ }
+ }
+ }
+ node {
+ name: "mean/AssignAdd_1"
+ op: "AssignAdd"
+ input: "mean/count"
+ input: "mean/ToFloat_1"
+ input: "^fifo_queue_Dequeue"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_class"
+ value {
+ list {
+ s: "loc:@mean/count"
+ }
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "use_locking"
+ value {
+ b: false
+ }
+ }
+ }
+ node {
+ name: "mean/Greater/y"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ }
+ float_val: 0.0
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/Greater"
+ op: "Greater"
+ input: "mean/count/read"
+ input: "mean/Greater/y"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/truediv"
+ op: "RealDiv"
+ input: "mean/total/read"
+ input: "mean/count/read"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/value/e"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ }
+ float_val: 0.0
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/value"
+ op: "Select"
+ input: "mean/Greater"
+ input: "mean/truediv"
+ input: "mean/value/e"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/Greater_1/y"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ }
+ float_val: 0.0
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/Greater_1"
+ op: "Greater"
+ input: "mean/AssignAdd_1"
+ input: "mean/Greater_1/y"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/truediv_1"
+ op: "RealDiv"
+ input: "mean/AssignAdd"
+ input: "mean/AssignAdd_1"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/update_op/e"
+ op: "Const"
+ device: "/device:CPU:0"
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ }
+ float_val: 0.0
+ }
+ }
+ }
+ }
+ node {
+ name: "mean/update_op"
+ op: "Select"
+ input: "mean/Greater_1"
+ input: "mean/truediv_1"
+ input: "mean/update_op/e"
+ device: "/device:CPU:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "_output_shapes"
+ value {
+ list {
+ shape {
+ }
+ }
+ }
+ }
+ }
+ node {
+ name: "init"
+ op: "NoOp"
+ input: "^mean/total/Assign"
+ input: "^mean/count/Assign"
+ device: "/device:CPU:0"
+ }
+ versions {
+ producer: 23
+ }
+}
+collection_def {
+ key: "local_variables"
+ value {
+ node_list {
+ value: "mean/total:0"
+ value: "mean/count:0"
+ }
+ }
+}
+collection_def {
+ key: "update_op"
+ value {
+ node_list {
+ value: "mean/update_op:0"
+ }
+ }
+}