Missed TensorFlow World? Check out the recap. Learn more

nsl.configs.make_adv_reg_config

View source on GitHub

Creates an nsl.configs.AdvRegConfig object.

nsl.configs.make_adv_reg_config(
    multiplier=attr.fields(AdvRegConfig).multiplier.default,
    feature_mask=attr.fields(AdvNeighborConfig).feature_mask.default,
    adv_step_size=attr.fields(AdvNeighborConfig).adv_step_size.default,
    adv_grad_norm=attr.fields(AdvNeighborConfig).adv_grad_norm.default
)

Used in the tutorials:

Args:

  • multiplier: multiplier to adversarial regularization loss. Defaults to 0.2.
  • feature_mask: mask (w/ 0-1 values) applied on the gradient. The shape should be the same as (or broadcastable to) input features. If set to None, no feature mask will be applied.
  • adv_step_size: step size to find the adversarial sample. Defaults to 0.001.
  • adv_grad_norm: type of tensor norm to normalize the gradient. Input will be converted to NormType when applicable (e.g., a value of 'l2' will be converted to nsl.configs.NormType.L2). Defaults to L2 norm.

Returns:

An nsl.configs.AdvRegConfig object.