class_docstr: Graph robust neural architecture estimator under adversarial attack.
  
  Use model directly to get estimations.
  
  Parameters
  ----------
  loss_f : str
      The name of loss funciton in PyTorch
  evaluation : list of Evaluation
      The evaluation metrics in module/train/evaluation
      GRNA_metric = acc_metric+ robustness_metric
  lambda: float
      The hyper-parameter to balance the accuracy metric and robustness metric to perform ultimate evaluation
  perturb_type: str
      Perturbation methods to simulate the adversarial attack process
  adv_sample_num: int
      Adversarial sample number used in measure architecture robustness.
class_docstr_tok: ["Graph","robust","neural","architecture","estimator","under","adversarial","attack",".","Use","model","directly","to","get","estimations",".","Parameters","--","--","--","--","--","loss_f",":","str","The","name","of","loss","funciton","in","PyTorch","evaluation",":","list","of","Evaluation","The","evaluation","metrics","in","module\/train\/evaluation","GRNA_metric","=","acc_metric+","robustness_metric","lambda",":","float","The","hyper-parameter","to","balance","the","accuracy","metric","and","robustness","metric","to","perform","ultimate","evaluation","perturb_type",":","str","Perturbation","methods","to","simulate","the","adversarial","attack","process","adv_sample_num",":","int","Adversarial","sample","number","used","in","measure","architecture","robustness","."]
code: def gen_adversarial_samples(
      self, edge_index, num_nodes, perturb_prop, attack_method="random"
  ):
      if num_nodes is None:
          num_nodes = max(edge_index[0]) + 1
  
      edge_index = edge_index.detach().cpu().numpy()
      delta = int(edge_index.shape[1] // 2 * perturb_prop)
      v = np.ones_like(edge_index[0])
      adj = sp.csr_matrix(
          (v, (edge_index[0], edge_index[1])),
          shape=(num_nodes, num_nodes),
      )
      if attack_method == "random":
          attacker = Random()
          attacker.attack(adj, n_perturbations=delta, type="flip")
      elif attack_method == "dice":
          labels = self.data.y.cpu().numpy()
          attacker = DICE()
          attacker.attack(adj, labels, delta)
      else:
          assert False, "Wrong Type of attack method!"
  
      modified_adj = attacker.modified_adj  # scipy.sparse matrix
  
      return modified_adj.tocsr()
  
file_path: AutoGL/autogl/module/nas/estimator/grna_estimator.py
imports: import torch
  from deeprobust.graph.global_attack import Random, DICE
  import numpy
  import scipy.sparse
  from tqdm import tqdm
  import time
  import torch.nn.functional
  from .None import register_nas_estimator
  from ..space import BaseSpace
  from .base import BaseEstimator
  from ..backend import *
  from ...train.evaluation import Acc
  from ..utils import get_hardware_aware_metric
label_desc: Use image node_id 3 for calling the GRNAEstimator obj's underlying member method code with example usage: obj.gen_adversarial_samples(edge_index, num_nodes, perturb_prop, attack_method) and returns: modified_adj