code: def test_training_only_device(self, strategy):
      # tf.distribute APIs may enter device scopes, but the saved model should not
      # contain device annotations, since devices during training may not be
      # available when the saved model is used.
      #
      # Models trained with MultiWorkerMirroredStrategy is affected the most,
      # since under MultiWorkerMirroredStrategy the device annotations contain job
      # and task, which causes error if that job or task is not available even
      # with soft placement enabled.
  
      class Model(tf.Module):
          @tf.function(input_signature=[])
          def __call__(self):
              return tf.identity(1.0)
  
      export_dir = self.get_temp_dir()
      with strategy.scope(), tf.device("GPU:0"):
          m = Model()
          tf.saved_model.save(m, export_dir)
  
      export_dir = self.get_temp_dir()
      loaded = tf.saved_model.load(export_dir)
      graph = loaded.signatures["serving_default"].graph
      for op in graph.get_operations():
          self.assertEqual(op.device, "")
      self.assertEqual(loaded().numpy(), 1.0)
  
imports: import os
  from absl.testing import parameterized
  import tensorflow
  import tensorflow.compat.v1
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.distribute import parameter_server_strategy_v2
  from tensorflow.python.distribute import sharded_variable
  from tensorflow.python.distribute import strategy_combinations
  from tensorflow.python.distribute import test_util
  from tensorflow.python.distribute import values
  from tensorflow.python.eager import context
  from tensorflow.python.eager import test
  from tensorflow.python.ops import lookup_ops
label_desc: Use image node_id 5 for calling the SaveAndLoadForServingTest obj's underlying member method code with example usage: obj.test_training_only_device(strategy) and returns: tf