class_docstr: Strategy extension that support both single and multi worker strategy.
code: def _create_variable(self, next_creator, **kwargs):
      # Make sure the pop the `use_resource` which is not supported by the
      # base tf.Variable. The `use_resource` is added by
      # creator_with_resource_vars in distribute_lib.py
      kwargs.pop("use_resource", None)
  
      # Ignore the colocate_with for the mirrored strategy. Each of the device
      # will get same copy of variable in the DTensor's case.
      # `colocate_with` is added when user call:
      # strategy.extended.colocate_vars_with(variable)
      kwargs.pop("colocate_with", None)
  
      # Ignore expected_shape, which is from the v1 Variable. Keras was somehow
      # using the v1 Variable, but didn't specify that value particularly.
      kwargs.pop("expected_shape", None)
  
      # Make sure to call DVariable initializer under the scope so that it will
      # have the proper replicated layout. The initial_value is multi-typed,
      # eg it can be a tensor, or a python/numpy type, or a callable that
      # produce tensor/python/numpy types. In all those cases, we need to wrap
      # them invoke convert_to_tensor() under the scope so that the proper
      # layout can be assigned.
  
      # TODO(scottzhu): The layout information should be injected via kwargs, or
      # lazily set later.
      initial_value = kwargs.pop("initial_value")
      dtype = kwargs.get("dtype", None)
  
      def new_initial_value():
          if callable(initial_value):
              init_var = ops.convert_to_tensor(
                  initial_value(), dtype=dtype
              )
          else:
              init_var = ops.convert_to_tensor(
                  initial_value, dtype=dtype
              )
          rank = init_var.shape.rank
          return d_api.copy_to_mesh(
              init_var, layout.Layout.replicated(self._mesh, rank)
          )
  
      return d_variable.DVariable(new_initial_value, **kwargs)
  
imports: import functools
  from tensorflow.dtensor.python import api
  from tensorflow.dtensor.python import config
  from tensorflow.dtensor.python import d_variable
  from tensorflow.dtensor.python import input_util
  from tensorflow.dtensor.python import layout
  from tensorflow.python.data.experimental.ops import distribute
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import distribute_utils
  from tensorflow.python.distribute.experimental import dtensor_util
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling the DTensorStrategyExtended obj's underlying member method code with example usage: obj._create_variable(next_creator) and returns: d_variable, d_api