code: def test_materialize_subnetwork_reports(
      self,
      input_fn,
      subnetwork_reports_fn,
      steps,
      iteration_number=0,
      included_subnetwork_names=None,
      want_materialized_reports=None,
  ):
      with context.graph_mode():
          tf.constant(
              0.0
          )  # dummy op so that the session graph is never empty.
          features, labels = input_fn()
          subnetwork_reports = subnetwork_reports_fn(features, labels)
          with self.test_session() as sess:
              sess.run(tf_compat.v1.initializers.local_variables())
              report_materializer = ReportMaterializer(
                  input_fn=input_fn, steps=steps
              )
              materialized_reports = (
                  report_materializer.materialize_subnetwork_reports(
                      sess,
                      iteration_number,
                      subnetwork_reports,
                      included_subnetwork_names,
                  )
              )
              self.assertEqual(
                  len(want_materialized_reports),
                  len(materialized_reports),
              )
              materialized_reports_dict = {
                  blrm.name: blrm for blrm in materialized_reports
              }
              for want_materialized_report in want_materialized_reports:
                  materialized_report = materialized_reports_dict[
                      want_materialized_report.name
                  ]
                  self.assertEqual(
                      iteration_number,
                      materialized_report.iteration_number,
                  )
                  self.assertEqual(
                      set(want_materialized_report.hparams.keys()),
                      set(materialized_report.hparams.keys()),
                  )
                  for (
                      hparam_key,
                      want_hparam,
                  ) in want_materialized_report.hparams.items():
                      if isinstance(want_hparam, float):
                          self.assertAllClose(
                              want_hparam,
                              materialized_report.hparams[hparam_key],
                          )
                      else:
                          self.assertEqual(
                              want_hparam,
                              materialized_report.hparams[hparam_key],
                          )
  
                  self.assertSetEqual(
                      set(want_materialized_report.attributes.keys()),
                      set(materialized_report.attributes.keys()),
                  )
                  for (
                      attribute_key,
                      want_attribute,
                  ) in want_materialized_report.attributes.items():
                      if isinstance(want_attribute, float):
                          self.assertAllClose(
                              want_attribute,
                              decode(
                                  materialized_report.attributes[
                                      attribute_key
                                  ]
                              ),
                          )
                      else:
                          self.assertEqual(
                              want_attribute,
                              decode(
                                  materialized_report.attributes[
                                      attribute_key
                                  ]
                              ),
                          )
  
                  self.assertSetEqual(
                      set(want_materialized_report.metrics.keys()),
                      set(materialized_report.metrics.keys()),
                  )
                  for (
                      metric_key,
                      want_metric,
                  ) in want_materialized_report.metrics.items():
                      if isinstance(want_metric, float):
                          self.assertAllClose(
                              want_metric,
                              decode(
                                  materialized_report.metrics[
                                      metric_key
                                  ]
                              ),
                          )
                      else:
                          self.assertEqual(
                              want_metric,
                              decode(
                                  materialized_report.metrics[
                                      metric_key
                                  ]
                              ),
                          )
  
file_path: adanet/adanet/core/report_materializer_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  from adanet import subnetwork
  from adanet import tf_compat
  from adanet.core.report_materializer import ReportMaterializer
  import adanet.core.testing_utils
  import tensorflow.compat.v2
  from tensorflow.python.eager import context
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 1 for calling the ReportMaterializerTest obj's underlying member method code with example usage: obj.test_materialize_subnetwork_reports(input_fn, subnetwork_reports_fn, steps, iteration_number, included_subnetwork_names, want_materialized_reports) without return types