docstr: Filter the models according to predicted latency. If the predicted latency of the ir model is larger than
  the given threshold, the ir model will be filtered and will not be considered as a searched architecture.
  
  Parameters
  ----------
  threshold: `float`
      the threshold of latency
  config, hardware:
      determine the targeted device
  reverse: `bool`
      if reverse is `False`, then the model returns `True` when `latency < threshold`,
      else otherwise
docstr_tok: ["Filter","the","models","according","to","predicted","latency",".","If","the","predicted","latency","of","the","ir","model","is","larger","than","the","given","threshold",",","the","ir","model","will","be","filtered","and","will","not","be","considered","as","a","searched","architecture",".","Parameters","--","--","--","--","--","threshold",":","`","float","`","the","threshold","of","latency","config",",","hardware",":","determine","the","targeted","device","reverse",":","`","bool","`","if","reverse","is","`","False","`",",","then","the","model","returns","`","True","`","when","`","latency","<","threshold","`",",","else","otherwise"]
code: def __init__(
      self, threshold, predictor, predictor_version=None, reverse=False
  ):
      """
      Filter the models according to predicted latency. If the predicted latency of the ir model is larger than
      the given threshold, the ir model will be filtered and will not be considered as a searched architecture.
  
      Parameters
      ----------
      threshold: `float`
          the threshold of latency
      config, hardware:
          determine the targeted device
      reverse: `bool`
          if reverse is `False`, then the model returns `True` when `latency < threshold`,
          else otherwise
      """
      self.predictors = load_latency_predictor(
          predictor, predictor_version
      )
      self.threshold = threshold
  
imports: import time
  import json
  import random
  import logging
  import argparse
  import numpy
  import torch
  import torchvision.transforms
  import torchvision.datasets
  import nni
  from nn_meter import load_latency_predictor
  import nni.retiarii.nn.pytorch
  import nni.retiarii.strategy
  from nni.retiarii.evaluator.functional import FunctionalEvaluator
  from nni.retiarii.utils import original_state_dict_hooks
  from nni.retiarii.oneshot.pytorch.utils import AverageMeterGroup
  from nni.retiarii.experiment.pytorch import RetiariiExeConfig, RetiariiExperiment
  from network import ShuffleNetV2OneShot, load_and_parse_state_dict
  from utils import CrossEntropyLabelSmooth, accuracy, ToBGRTensor, get_archchoice_by_model
label_desc: Use image node_id 1 to create a new LatencyFilter object  with example: obj = LatencyFilter(threshold, predictor, predictor_version, reverse)