code: def testMetadataSaved(self):
      # We need to use one default session so that self.evaluate and the
      # SavedModel loader share the same session.
      with tf.compat.v1.Session().as_default():
          network = q_network.QNetwork(
              input_tensor_spec=self._time_step_spec.observation,
              action_spec=self._action_spec,
          )
  
          policy = q_policy.QPolicy(
              time_step_spec=self._time_step_spec,
              action_spec=self._action_spec,
              q_network=network,
          )
          self.evaluate(
              tf.compat.v1.initializers.variables(policy.variables())
          )
  
          train_step = common.create_variable(
              "train_step", initial_value=1
          )
          env_step = common.create_variable("env_step", initial_value=7)
          metadata = {"env_step": env_step}
          self.evaluate(
              tf.compat.v1.initializers.variables(
                  [train_step, env_step]
              )
          )
  
          saver = policy_saver.PolicySaver(
              policy,
              batch_size=None,
              train_step=train_step,
              metadata=metadata,
          )
          if tf.executing_eagerly():
              loaded_metadata = saver.get_metadata()
          else:
              loaded_metadata = self.evaluate(saver.get_metadata())
          self.assertEqual(self.evaluate(metadata), loaded_metadata)
  
          path = os.path.join(self.get_temp_dir(), "save_model")
          saver.save(path)
  
          reloaded = tf.compat.v2.saved_model.load(path)
          self.evaluate(tf.compat.v1.global_variables_initializer())
          self.assertIn("get_metadata", reloaded.signatures)
          env_step_value = self.evaluate(reloaded.get_metadata())[
              "env_step"
          ]
          self.assertEqual(7, env_step_value)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import os
  import shutil
  from absl.testing import parameterized
  import numpy
  import tensorflow
  import tensorflow_probability
  from tf_agents.networks import actor_distribution_network
  from tf_agents.networks import q_network
  from tf_agents.networks import q_rnn_network
  from tf_agents.policies import actor_policy
  from tf_agents.policies import policy_saver
  from tf_agents.policies import q_policy
  from tf_agents.policies import tf_policy
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import policy_step
  from tf_agents.trajectories import time_step
  from tf_agents.utils import common
  from tf_agents.utils import test_utils
label_desc: Use image node_id 13 for calling the PolicySaverTest obj's underlying member method code with example usage: obj.testMetadataSaved() without return types