code: def test_captured_variable_from_other_function_raises(self):
      def f(model):
          if not model:
              model.append(tf.Variable(1.0))
              model.append(tf.Variable(1.0, trainable=False))
          return sum(model)
  
      f = hk.transform_with_state(f)
  
      model = []
      params, state = f.init(model)
      self.assertLen(params, 1)
      self.assertLen(state, 1)
  
      with self.assertRaisesRegex(
          ValueError, "TensorVariable .* has no value"
      ):
          f.init(model)
  
imports: from absl.testing import parameterized
  import sonnet
  from sonnet.src import test_utils
  from sonnet.src.functional import haiku
  import tensorflow
  import tree
label_desc: Use image node_id 9 for calling the TensorVariableTest obj's underlying member method code with example usage: obj.test_captured_variable_from_other_function_raises() and returns: sum