code: def test_gradient_disabled(self):
      f_jax = lambda x: x * x
  
      model = tf.Module()
      model.f = tf.function(
          jax2tf.convert(f_jax, with_gradient=False),
          autograph=False,
          input_signature=[tf.TensorSpec([], tf.float32)],
      )
      x = np.array(0.7, dtype=jnp.float32)
      self.assertAllClose(model.f(x), f_jax(x))
      restored_model = tf_test_util.SaveAndLoadModel(model)
      xv = tf.Variable(0.7, dtype=jnp.float32)
      self.assertAllClose(restored_model.f(x), f_jax(x))
  
      with self.assertRaisesRegex(
          LookupError,
          "Gradient explicitly disabled.*The jax2tf-converted function does not support gradients",
      ):
          with tf.GradientTape():
              _ = restored_model.f(xv)
  
imports: from absl.testing import absltest
  import os
  import jax
  from jax import lax
  import jax.numpy
  import numpy
  import tensorflow
  from jax.experimental import jax2tf
  from jax.experimental.jax2tf.tests import tf_test_util
  from jax._src import test_util
  from jax import config
label_desc: Use image node_id 4 for calling the SavedModelTest obj's underlying member method code with example usage: obj.test_gradient_disabled() without return types