class_docstr: Forecaster base model for lstm, seq2seq, tcn and nbeats forecasters.
class_docstr_tok: ["Forecaster","base","model","for","lstm",",","seq2seq",",","tcn","and","nbeats","forecasters","."]
docstr: Build openvino model to speed up inference and reduce latency.
  The method is Not required to call before predict_with_openvino.
  
  It is recommended to use when you want to:
  
  | 1. Strictly control the thread to be used during inferencing.
  | 2. Alleviate the cold start problem when you call predict_with_openvino
       for the first time.
  
  :param thread_num: int, the num of thread limit. The value is set to 1 by
         default where no limit is set. Besides, the environment variable
         `OMP_NUM_THREADS` is suggested to be same as `thread_num`.
code: def build_openvino(self, thread_num=1):
      """
      Build openvino model to speed up inference and reduce latency.
      The method is Not required to call before predict_with_openvino.
  
      It is recommended to use when you want to:
  
      | 1. Strictly control the thread to be used during inferencing.
      | 2. Alleviate the cold start problem when you call predict_with_openvino
           for the first time.
  
      :param thread_num: int, the num of thread limit. The value is set to 1 by
             default where no limit is set. Besides, the environment variable
             `OMP_NUM_THREADS` is suggested to be same as `thread_num`.
      """
      from bigdl.chronos.pytorch import (
          TSInferenceOptimizer as InferenceOptimizer,
      )
  
      if self.distributed:
          invalidInputError(
              False,
              "build_openvino has not been supported for distributed "
              "forecaster. You can call .to_local() to transform the "
              "forecaster to a non-distributed version.",
          )
      try:
          OMP_NUM_THREADS = os.getenv("OMP_NUM_THREADS")
      except KeyError:
          OMP_NUM_THREADS = 0
      if OMP_NUM_THREADS != str(thread_num):
          warnings.warn(
              "The environment variable OMP_NUM_THREADS is suggested to be same "
              f"as thread_num.You can use 'export OMP_NUM_THREADS={thread_num}'."
          )
      dummy_input = torch.rand(
          1,
          self.data_config["past_seq_len"],
          self.data_config["input_feature_num"],
      )
      self.accelerated_model = InferenceOptimizer.trace(
          self.internal,
          input_sample=dummy_input,
          accelerator="openvino",
          thread_num=thread_num,
          output_tensors=False,
      )
      self.optimized_model_output_tensor = False
      self.accelerate_method = "openvino_fp32"
      self.optimized_model_thread_num = thread_num
  
imports: from bigdl.chronos.forecaster.abstract import Forecaster
  from bigdl.chronos.forecaster.utils import *
  from bigdl.chronos.metric.forecast_metrics import Evaluator
  from typing import Optional
  import numpy
  import warnings
  import os
  from tempfile import TemporaryDirectory
  import torch
  from torch.utils.data import TensorDataset, DataLoader
  from .utils_hpo import GenericLightningModule, _format_metric_str, _config_has_search_space
  from bigdl.nano.utils.common import invalidOperationError, invalidInputError
  from bigdl.chronos.data.tsdataset import TSDataset
  from bigdl.chronos.pytorch.context_manager import DummyForecasterContextManager, ForecasterContextManager
  from bigdl.chronos.pytorch.utils import _pytorch_fashion_inference
label_desc: Use image node_id 20 for calling the BasePytorchForecaster obj's underlying member method code with example usage: obj.build_openvino(thread_num) without return types