code: def testCreateVarInsideFunctionWithInitScope(self):
      var = Var()
  
      @polymorphic_function.function
      def assign_add():
          with ops.init_scope():
              if var.v is None:
                  c = constant_op.constant(1.0)
                  c = api.relayout(
                      c, Layout.replicated(self.mesh, rank=0)
                  )
                  var.v = variables.Variable(c)
          var.v.assign_add(1.0)
  
      with api._dtensor_device()._default_layout(
          Layout.replicated(self.mesh, rank=0)
      ):
          assign_add()
          output = var.v.read_value()
          api.check_layout(output, Layout.replicated(self.mesh, rank=0))
          self.assertAllEqual(output, 2.0)
  
imports: import numpy
  from tensorflow.dtensor.python import api
  from tensorflow.dtensor.python import d_variable
  from tensorflow.dtensor.python import layout
  from tensorflow.dtensor.python.tests import test_util
  from tensorflow.python.eager.polymorphic_function import polymorphic_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 10 for calling the DTensorVariableTest obj's underlying member method code with example usage: obj.testCreateVarInsideFunctionWithInitScope() without return types