コード例 #1
0
def _fgsm_example_and_bound(params, target_label, label):
  model_fn = lambda x: utils.predict_mlp(params, x)
  x = 0.5 * jnp.ones(utils.nn_layer_sizes(params)[0])
  epsilon = 0.5
  x_adv = utils.fgsm_single(model_fn, x, label, target_label, epsilon,
                            num_steps=30, step_size=0.03)
  return x_adv, utils.adv_objective(model_fn, x_adv, label, target_label)
コード例 #2
0
 def fun_to_extract(inputs):
     inp = (inputs - input_mean) / input_std
     return utils.predict_mlp(mlp_params, inp)
コード例 #3
0
ファイル: run_lp_solver.py プロジェクト: deepmind/jax_verify
 def model_fn(params, inputs):
   inputs = np.reshape(inputs, (inputs.shape[0], -1))
   return utils.predict_mlp(params, inputs)
コード例 #4
0
 def spec_fn(x):
     x = utils.predict_mlp(verif_instance.params, x)
     x = jax.nn.relu(x)
     return jnp.sum(jnp.reshape(x, (-1, )) *
                    verif_instance.obj) + verif_instance.const