docstr: Do validation. During validation, LayerChoices use the mixed-op.
  
  Returns
  -------
  float, float
      average loss, average nme
docstr_tok: ["Do","validation",".","During","validation",",","LayerChoices","use","the","mixed-op",".","Returns","--","--","--","-","float",",","float","average","loss",",","average","nme"]
code: def _validate(self):
      """
      Do validation. During validation, LayerChoices use the mixed-op.
  
      Returns
      -------
      float, float
          average loss, average nme
      """
  
      # test on validation set under eval mode
      self.model.eval()
      self.auxiliarynet.eval()
  
      losses, nme = list(), list()
      batch_time = AverageMeter("batch_time")
      end = time.time()
      with torch.no_grad():
          for i, (img, land_gt, angle_gt) in enumerate(
              self.valid_loader
          ):
              img = img.to(self.device, non_blocking=True)
              landmark_gt = land_gt.to(self.device, non_blocking=True)
              angle_gt = angle_gt.to(self.device, non_blocking=True)
  
              landmark, _ = self.model(img)
  
              # compute the l2 loss
              landmark = landmark.squeeze()
              l2_diff = torch.sum((landmark_gt - landmark) ** 2, axis=1)
              loss = torch.mean(l2_diff)
              losses.append(loss.cpu().detach().numpy())
  
              # compute the accuracy
              landmark = landmark.cpu().detach().numpy()
              landmark = landmark.reshape(landmark.shape[0], -1, 2)
              landmark_gt = landmark_gt.cpu().detach().numpy()
              landmark_gt = landmark_gt.reshape(
                  landmark_gt.shape[0], -1, 2
              )
              _, nme_i = accuracy(landmark, landmark_gt)
              for item in nme_i:
                  nme.append(item)
  
              # measure elapsed time
              batch_time.update(time.time() - end)
              end = time.time()
  
      self.logger.info("===> Evaluate:")
      self.logger.info(
          "Eval set: Average loss: {:.4f} nme: {:.4f}".format(
              np.mean(losses), np.mean(nme)
          )
      )
      return np.mean(losses), np.mean(nme)
  
file_path: nni/examples/nas/legacy/oneshot/pfld/lib/trainer.py
imports: from __future__ import absolute_import, division, print_function
  import os
  import time
  import torch
  import numpy
  from nni.algorithms.nas.pytorch.fbnet import FBNetTrainer
  from nni.nas.pytorch.utils import AverageMeter
  from .utils import accuracy
label_desc: Use image node_id 2 for calling the PFLDTrainer obj's underlying member method code with example usage: obj._validate() and returns: np,  np