class_docstr: Wrapper thats adds adversarial regularization to a given `tf.keras.Model`.
  
  This model will reuse the layers and variables as the given `base_model`, so
  training this model will also update the variables in the `base_model`. The
  adversarial regularization can be configured by `adv_config`. (See
  `nsl.configs.AdvRegConfig` for the hyperparameters.) The regularization term
  will be added into training objective, and will be minimized during training
  together with other losses specified in `compile()`.
  
  This model expects its input to be a dictionary mapping feature names to
  feature values. The dictionary should contain both input data (`x`) and target
  data (`y`). The feature names of the target data should be passed to this
  model's constructor in `label_keys`, so the model can distinguish between
  input data and target data. If your samples are weighted, the sample weight
  should also be a feature in the dictionary, and its name should be passed to
  the constructor in `sample_weight_key`. When calling this model's `fit()` or
  `evaluate()` method, the argument `y` should not be set because the target
  data is already in the input dictionary. The dictionary format also implies
  that the input has to be named, i.e. the `name` argument of `tf.keras.Input()`
  should be set.
  
  Example:
  
  ```python
  # A linear regression model (for demonstrating the usage only)
  base_model = tf.keras.Sequential([
      tf.keras.Input(shape=(2,), name='input'),
      tf.keras.layers.Dense(1),
  ])
  
  # Applies the wrapper, with 0.2 as regularization weight.
  adv_config = nsl.configs.make_adv_reg_config(multiplier=0.2)
  adv_model = nsl.keras.AdversarialRegularization(base_model,
                                                  label_keys=['label'],
                                                  adv_config=adv_config)
  
  # Compiles the model as usual.
  adv_model.compile(optimizer='adam', loss='mean_squared_error')
  
  # Trains the model. (The actual training data is omitted for clarity.)
  # The model minimizes (mean_squared_error + 0.2 * adversarial_regularization).
  adv_model.fit(x={'input': x_train, 'label': y_train}, batch_size=32)
  ```
  
  It is recommended to use `tf.data.Dataset` to handle the dictionary format
  requirement of the input, especially when using the `validation_data` argument
  in `fit()`.
  
  ```python
  train_data = tf.data.Dataset.from_tensor_slices(
      {'input': x_train, 'label': y_train}).batch(batch_size)
  val_data = tf.data.Dataset.from_tensor_slices(
      {'input': x_val, 'label': y_val}).batch(batch_size)
  val_steps = x_val.shape[0] / batch_size
  adv_model.fit(train_data, validation_data=val_data,
                validation_steps=val_steps, epochs=2, verbose=1)
  ```
code: def _build_loss_and_metric_fns(self, output_names):
      self._metric_name_count = collections.Counter()
      self._build_labeled_losses(output_names)
      self._build_labeled_metrics(output_names, self._labeled_losses)
      del self._metric_name_count
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import functools
  import types
  import attr
  import neural_structured_learning.configs
  from neural_structured_learning.lib import adversarial_neighbor
  import six
  import tensorflow
label_desc: Use image node_id 4 for calling the AdversarialRegularization obj's underlying member method code with example usage: obj._build_loss_and_metric_fns(output_names) without return types