code: def testPrepareSessionWithPartialInitOp(self):
      with ops.Graph().as_default():
          v = variable_v1.VariableV1(1, name="v")
          w = variable_v1.VariableV1(
              v,
              trainable=False,
              collections=[ops.GraphKeys.LOCAL_VARIABLES],
              name="w",
          )
          x = variable_v1.VariableV1(
              3 * v,
              trainable=False,
              collections=[ops.GraphKeys.LOCAL_VARIABLES],
              name="x",
          )
          # TODO(b/70206927): Use ResourceVariables once they are handled properly.
          v_res = variable_v1.VariableV1(1, name="v_res")
          w_res = variable_v1.VariableV1(
              v_res,
              trainable=False,
              collections=[ops.GraphKeys.LOCAL_VARIABLES],
              name="w_res",
          )
          x_res = variable_v1.VariableV1(
              3 * v_res,
              trainable=False,
              collections=[ops.GraphKeys.LOCAL_VARIABLES],
              name="x_res",
          )
  
          with self.cached_session():
              self.assertEqual(
                  False, variable_v1.is_variable_initialized(v).eval()
              )
              self.assertEqual(
                  False, variable_v1.is_variable_initialized(w).eval()
              )
              self.assertEqual(
                  False, variable_v1.is_variable_initialized(x).eval()
              )
              self.assertEqual(
                  False,
                  variable_v1.is_variable_initialized(v_res).eval(),
              )
              self.assertEqual(
                  False,
                  variable_v1.is_variable_initialized(w_res).eval(),
              )
              self.assertEqual(
                  False,
                  variable_v1.is_variable_initialized(x_res).eval(),
              )
          sm2 = session_manager.SessionManager(
              local_init_op=[
                  w.initializer,
                  x.initializer,
                  w_res.initializer,
                  x_res.initializer,
              ]
          )
          sess = sm2.prepare_session("", init_op=None)
          self.assertEqual(
              False,
              variable_v1.is_variable_initialized(
                  sess.graph.get_tensor_by_name("v:0")
              ).eval(session=sess),
          )
          self.assertEqual(
              True,
              variable_v1.is_variable_initialized(
                  sess.graph.get_tensor_by_name("w:0")
              ).eval(session=sess),
          )
          self.assertEqual(
              True,
              variable_v1.is_variable_initialized(
                  sess.graph.get_tensor_by_name("x:0")
              ).eval(session=sess),
          )
          self.assertEqual(1, sess.run(w))
          self.assertEqual(3, sess.run(x))
          self.assertEqual(
              False,
              variable_v1.is_variable_initialized(
                  sess.graph.get_tensor_by_name("v_res:0")
              ).eval(session=sess),
          )
          self.assertEqual(
              True,
              variable_v1.is_variable_initialized(
                  sess.graph.get_tensor_by_name("w_res:0")
              ).eval(session=sess),
          )
          self.assertEqual(
              True,
              variable_v1.is_variable_initialized(
                  sess.graph.get_tensor_by_name("x_res:0")
              ).eval(session=sess),
          )
          self.assertEqual(1, sess.run(w_res))
          self.assertEqual(3, sess.run(x_res))
  
imports: import os
  from tensorflow.python.checkpoint import checkpoint_management
  from tensorflow.python.client import session
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import resource_variables_toggle
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import test
  from tensorflow.python.training import saver
  from tensorflow.python.training import server_lib
  from tensorflow.python.training import session_manager
label_desc: Use image node_id 19 for calling the SessionManagerTest obj's underlying member method code with example usage: obj.testPrepareSessionWithPartialInitOp() without return types