class_docstr: A object which creates evaluation metrics for Ensembles.
class_docstr_tok: ["A","object","which","creates","evaluation","metrics","for","Ensembles","."]
docstr: Returns a representation of an ensemble's architecture as a tf.metric.
docstr_tok: ["Returns","a","representation","of","an","ensemble","'s","architecture","as","a","tf.metric","."]
code: def _architecture_as_metric(self, architecture):
      """Returns a representation of an ensemble's architecture as a tf.metric."""
  
      def _architecture_metric_fn():
          """Manually creates the tf.metric with a serialized tf.Summary proto."""
  
          # TODO: Should architecture.subnetworks be sorted by iteration
          # number first? Or perhaps, to make this more general, to have one line
          # for each iteration, with "|" as a delimiter if there are multiple
          # subnetworks in one iteration? Something like:
          # 0 linear
          # 1 dnn_width_32_depth_1 | dnn_width_64_depth_1
          # 2
          # 3 dnn_with_32_depth_2
          # Also consider adding ensemble candidate's name, though that is already
          # included in the ensemble name.
          architecture_ = " | ".join(
              [name for _, name in architecture.subnetworks]
          )
          architecture_ = "| {} |".format(architecture_)
          summary_metadata = tf_compat.v1.SummaryMetadata(
              plugin_data=tf_compat.v1.SummaryMetadata.PluginData(
                  plugin_name="text"
              )
          )
          summary_proto = tf_compat.v1.summary.Summary()
          summary_proto.value.add(
              metadata=summary_metadata,
              tag="architecture/adanet",
              tensor=tf_compat.v1.make_tensor_proto(
                  architecture_, dtype=tf.string
              ),
          )
          architecture_summary = tf.convert_to_tensor(
              value=summary_proto.SerializeToString(),
              name="architecture",
          )
  
          return {
              "architecture/adanet/ensembles": (
                  architecture_summary,
                  tf.no_op(),
              )
          }
  
      if not self._use_tpu:
          ops = _architecture_metric_fn()
          return lambda: ops
      else:
          return _architecture_metric_fn
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import inspect
  from absl import logging
  from adanet import tf_compat
  import six
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling the _EnsembleMetrics obj's underlying member method code with example usage: obj._architecture_as_metric(architecture) and returns: dict, function, _architecture_metric_fn