docstr: check if the pipeline need to be reloaded and set current corresponding status
  
  Args:
      optimization_method:
          the optimization method, could be nano_jit, nano_openvino, bes_openvino
      opt_postfix:
          the config of this optimization method, e.g. nano_jit could have ipex enabled/disabled
docstr_tok: ["check","if","the","pipeline","need","to","be","reloaded","and","set","current","corresponding","status","Args",":","optimization_method",":","the","optimization","method",",","could","be","nano_jit",",","nano_openvino",",","bes_openvino","opt_postfix",":","the","config","of","this","optimization","method",",","e.g",".","nano_jit","could","have","ipex","enabled\/disabled"]
code: def need_init_pipeline(
      self,
      version,
      device,
      precision,
      optimization_method,
      opt_postfix="",
  ):
      r"""
      check if the pipeline need to be reloaded and set current corresponding status
  
      Args:
          optimization_method:
              the optimization method, could be nano_jit, nano_openvino, bes_openvino
          opt_postfix:
              the config of this optimization method, e.g. nano_jit could have ipex enabled/disabled
      """
      if (
          self.optimization_method + self.opt_postfix
          != optimization_method + opt_postfix
          or self.version != version
          or self.device != device
          or self.precision != precision
      ):
          res = True
          self.pipe = None  # free memory
          print(
              f"Switching pipeline from {self.version}/{self.precision}/{self.device}/{self.optimization_method}/{self.opt_postfix} to {version}/{precision}/{device}/{optimization_method}/{opt_postfix}"
          )
      elif self.pipe is None:
          res = True
      else:
          res = False
      # record current pipeline config
      self.optimization_method = optimization_method
      self.opt_postfix = opt_postfix
      self.version, self.device, self.precision = (
          version,
          device,
          precision,
      )
      return res
  
imports: from typing import ClassVar, Optional
  import torch
  import os
  from bigdl.nano.pytorch import InferenceOptimizer
  from diffusers.schedulers import *
  from .utils import get_snapshot_dir_from_model_version
  from .pipelines import NanoStableDiffusionPipeline
label_desc: Use image node_id 4 for calling the StableDiffusionRunner obj's underlying member method code with example usage: obj.need_init_pipeline(version, device, precision, optimization_method, opt_postfix) and returns: res