docstr: Test that variable access order is consistent in built in modules.
docstr_tok: ["Test","that","variable","access","order","is","consistent","in","built","in","modules","."]
code: def test_variable_order_is_constant(
      self, module_fn, input_shape, dtype, construct_module_in_function
  ):
      """Test that variable access order is consistent in built in modules."""
      logged_variables = []
      mod = [None]
      if not construct_module_in_function:
          mod[0] = module_fn()
  
      x = tf.zeros(input_shape, dtype=dtype)
  
      @tf.function(autograph=False)
      def f():
          with tf.GradientTape() as tape:
              if not mod[0]:
                  mod[0] = module_fn()
              mod[0](x)  # pylint: disable=not-callable
  
          # Leak out the variables that were used.
          logged_variables.append(
              [(id(v), v.name) for v in tape.watched_variables()]
          )
  
      # NOTE: This will run `f` twice iff `f` creates params.
      f()
  
      if len(logged_variables) == 1:
          self.skipTest(
              "Module did not create variables in forward pass."
          )
      else:
          assert len(logged_variables) == 2
          self.assertCountEqual(
              logged_variables[0], logged_variables[1]
          )
  
imports: from absl.testing import parameterized
  from sonnet.src import test_utils
  from sonnet.src.conformance import descriptors
  import tensorflow
label_desc: Use image node_id 1 for calling the OptimizerConformanceTest obj's underlying member method code with example usage: obj.test_variable_order_is_constant(module_fn, input_shape, dtype, construct_module_in_function) without return types