code: def test_gen_adv_neighbor_to_raise_for_sparse_tensors_v2(self):
      (
          x,
          w_sparse,
          w_dense,
          adv_config,
      ) = (
          self._test_gen_adv_neighbor_to_raise_for_sparse_tensors_setup()
      )
  
      with tf.GradientTape() as tape:
          tape.watch([x["sparse"].values, x["dense"]])
          prod_sparse = tf.reduce_sum(
              tf.sparse.sparse_dense_matmul(x["sparse"], w_sparse)
          )
          prod_dense = tf.reduce_sum(input_tensor=w_dense * x["dense"])
          loss = prod_dense + prod_sparse
  
      with self.assertRaisesRegex(ValueError, "Cannot perturb.*sparse"):
          adv_lib.gen_adv_neighbor(
              x,
              loss,
              adv_config,
              raise_invalid_gradient=True,
              gradient_tape=tape,
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import neural_structured_learning.configs
  from neural_structured_learning.lib import adversarial_neighbor
  import numpy
  import tensorflow
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 31 for calling the GenAdvNeighborTest obj's underlying member method code with example usage: obj.test_gen_adv_neighbor_to_raise_for_sparse_tensors_v2() without return types