docstr: Tests that ops.Operation is wrapped by a tensor for metric_ops.
docstr_tok: ["Tests","that","ops.Operation","is","wrapped","by","a","tensor","for","metric_ops","."]
code: def test_metric_op_is_tensor(self):
      """Tests that ops.Operation is wrapped by a tensor for metric_ops."""
      with context.graph_mode():
          loss = {"my_loss": constant_op.constant([0])}
          predictions = {"output1": constant_op.constant(["foo"])}
          mean, update_op = metrics_module.mean_tensor(
              constant_op.constant([0])
          )
          metrics = {
              "metrics_1": (mean, update_op),
              "metrics_2": (
                  constant_op.constant([0]),
                  control_flow_ops.no_op(),
              ),
              # Keras metric's update_state() could return a Variable, rather than
              # an Operation or Tensor.
              "keras_1": (
                  constant_op.constant([0.5]),
                  variables.Variable(1.0, name="AssignAddVariableOp_3"),
              ),
          }
  
          outputter = MockSupervisedOutput(loss, predictions, metrics)
          # If we get there, it means constructor succeeded; which is sufficient
          # for testing the constructor.
  
          self.assertTrue(
              outputter.metrics["metrics_1/update_op"].name.startswith(
                  "mean/update_op"
              )
          )
          self.assertIsInstance(
              outputter.metrics["metrics_1/update_op"], tensor.Tensor
          )
          self.assertIsInstance(
              outputter.metrics["metrics_1/value"], tensor.Tensor
          )
  
          self.assertEqual(
              outputter.metrics["metrics_2/value"],
              metrics["metrics_2"][0],
          )
          self.assertTrue(
              outputter.metrics["metrics_2/update_op"].name.startswith(
                  "metric_op_wrapper"
              )
          )
          self.assertIsInstance(
              outputter.metrics["metrics_2/update_op"], tensor.Tensor
          )
  
imports: from tensorflow.core.framework import tensor_shape_pb2
  from tensorflow.core.framework import types_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import metrics
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.saved_model import signature_constants
  from tensorflow.python.saved_model.model_utils import export_output
label_desc: Use image node_id 8 for calling the SupervisedOutputTest obj's underlying member method code with example usage: obj.test_metric_op_is_tensor() without return types