class_docstr: A two-stage pipeline, which will run all stages in parallel.
  
  A simple usage:
  ```
      pipeline = Pipeline([
          ("preprocess", preprocess, {}),
          ("inference", model, {}),
      ])
      outputs = pipeline.run(inputs)
  ```
class_docstr_tok: ["A","two-stage","pipeline",",","which","will","run","all","stages","in","parallel",".","A","simple","usage",":","``","`","pipeline","=","Pipeline","(","[","(","``","preprocess","''",",","preprocess",",","{","}",")",",","(","``","inference","''",",","model",",","{","}",")",",","]",")","outputs","=","pipeline.run","(","inputs",")","``","`"]
docstr: Conduct inference on the inputs in a pipeline.
  
  For example,
  ```
      outputs = pipeline.run(inputs)
  ```
  is equivalent to
  ```
      outputs = [model(preprocess(i)) for i in inputs]
  ```
  except that the pipeline will run all stages in parallel
  and handle inference automatically.
  
  :param inputs: A list of batches.
  :return: A list of the result of inference.
docstr_tok: ["Conduct","inference","on","the","inputs","in","a","pipeline",".","For","example",",","``","`","outputs","=","pipeline.run","(","inputs",")","``","`","is","equivalent","to","``","`","outputs","=","[","model","(","preprocess","(","i",")",")","for","i","in","inputs","]","``","`","except","that","the","pipeline","will","run","all","stages","in","parallel","and","handle","inference","automatically",".",":","param","inputs",":","A","list","of","batches",".",":","return",":","A","list","of","the","result","of","inference","."]
code: def run(self, inputs):
      """
      Conduct inference on the inputs in a pipeline.
  
      For example,
      ```
          outputs = pipeline.run(inputs)
      ```
      is equivalent to
      ```
          outputs = [model(preprocess(i)) for i in inputs]
      ```
      except that the pipeline will run all stages in parallel
      and handle inference automatically.
  
      :param inputs: A list of batches.
      :return: A list of the result of inference.
      """
      outputs = []
      for idx, value in enumerate(inputs):
          self.send_.put((idx, value))
          outputs.append(None)
  
      for _ in range(len(outputs)):
          idx, output = self.recv_.get()
          outputs[idx] = output
      return outputs
  
file_path: BigDL/python/nano/src/bigdl/nano/pytorch/inference/pipeline.py
imports: import itertools
  import multiprocessing
  import warnings
  from typing import List, Tuple, Callable
  from bigdl.nano.utils.common import EnvContext
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.common import schedule_workers
  from torch import nn
label_desc: Use image node_id 2 for calling the Pipeline obj's underlying member method code with example usage: obj.run(inputs) and returns: outputs