code: def test_gen_adv_neighbor_to_raise_for_sparse_tensors(self):
      (
          x,
          w_sparse,
          w_dense,
          adv_config,
      ) = (
          self._test_gen_adv_neighbor_to_raise_for_sparse_tensors_setup()
      )
      prod_sparse = tf.sparse.reduce_sum(w_sparse * x["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
          )
  
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 30 for calling the GenAdvNeighborTest obj's underlying member method code with example usage: obj.test_gen_adv_neighbor_to_raise_for_sparse_tensors() without return types