code: def test_gen_adv_neighbor_for_single_tensor_feature(self):
      # Simple linear regression
      x = tf.constant([[-1.0, 1.0]])
      y = tf.constant([0.0])
      w = tf.constant([[3.0], [4.0]])
      with tf.GradientTape() as tape:
          tape.watch(x)
          y_hat = tf.matmul(x, w)
          loss = tf.math.squared_difference(y, y_hat)
  
      adv_config = configs.AdvNeighborConfig(
          feature_mask=tf.constant(1.0),
          adv_step_size=0.1,
          adv_grad_norm="l2",
      )
      adv_neighbor, _ = adv_lib.gen_adv_neighbor(
          x, loss, adv_config, gradient_tape=tape
      )
  
      # gradient = [[6, 8]], normalized gradient = [[0.6, 0.8]]
      expected_neighbor = [[-1.0 + 0.1 * 0.6, 1.0 + 0.1 * 0.8]]
      actual_neighbor = self.evaluate(adv_neighbor)
      self.assertAllClose(expected_neighbor, actual_neighbor)
  
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 1 for calling the GenAdvNeighborTest obj's underlying member method code with example usage: obj.test_gen_adv_neighbor_for_single_tensor_feature() without return types