code: def with_soft_placement(f):
      """Wraps `f` such that it runs with soft device placement."""
  
      def wrapper(*a, **k):
          with tf.device(None):
              return f(*a, **k)
  
      return wrapper
  
imports: import os
  from absl import logging
  from absl.testing import absltest
  from absl.testing import parameterized
  from sonnet.src import test_utils
  from sonnet.src.conformance import goldens
  from sonnet.src.distribute import replicator
  from sonnet.src.distribute import replicator_test_utils
  import tensorflow
  import tree
label_desc: Use image node_id 1 for calling a global function with example usage: with_soft_placement(f) and returns: wrapper, f