code: def testSetLogicalDeviceAfterContextInitialization(self):
      ctx = context.Context()
      ctx.set_logical_cpu_devices(4)
      self.assertIs(len(ctx.list_logical_devices("CPU")), 4)
  
      # Cannot set logical device twice.
      with self.assertRaisesRegex(
          RuntimeError, "Virtual CPUs already set"
      ):
          ctx.set_logical_cpu_devices(8)
  
imports: import weakref
  from absl.testing import parameterized
  import numpy
  from xla.service import hlo_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 11 for calling the ContextTest obj's underlying member method code with example usage: obj.testSetLogicalDeviceAfterContextInitialization() without return types