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 infer(self, model: BaseSpace, dataset, mask="train"):
      device = next(model.parameters()).device
      dset = dataset[0].to(device)
      mask = bk_mask(dset, mask)
  
      pred = model(dset)[mask]
      label = bk_label(dset)
      y = label[mask]
  
      loss = getattr(F, self.loss_f)(pred, y)
      probs = F.softmax(pred, dim=1).detach().cpu().numpy()
  
      # robustness metric
      dist = 0
      for _ in range(self.adv_sample_num):
          modified_adj = self.gen_adversarial_samples(
              dset.edge_index,
              num_nodes=dset.num_nodes,
              perturb_prop=self.ptbr,
              attack_method=self.perturb_type,
          )
          d_data = dset.clone()
          d_data = d_data.to(device)
          edge_index = torch.LongTensor(
              np.vstack(
                  (modified_adj.tocoo().row, modified_adj.tocoo().col)
              )
          )
          d_data.edge_index = edge_index.to(device)
          perturb_pred = model(d_data)[mask]
          dist += distance(perturb_pred, pred, dis_type=self.dis_type)
      dist = dist / self.adv_sample_num
  
      y = y.cpu()
      metrics = [
          eva.evaluate(probs, y) + self.lambda_ * dist
          for eva in self.evaluation
      ]
  
      return metrics, loss
  
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 2 for calling the GRNAEstimator obj's underlying member method code with example usage: obj.infer(model, dataset, mask) and returns: metrics,  loss