code: def optimize_onnx(onnx_nodes, nchw_inputs=None, inputs=None, outputs=None):
      
      node_list = LinkedNode.build_from_onnx(onnx_nodes,
                                             nchw_inputs if nchw_inputs else [],
                                             [] if inputs is None else [i_.name for i_ in inputs],
                                             [] if outputs is None else [o_.name for o_ in outputs])
      solution = _find_an_optimization(node_list)
      while solution:
          node_list = _apply_optimization(solution, node_list)
          solution = _find_an_optimization(node_list)
  
      return _build_onnx_model(node_list)
docs: Optimize onnx model by several approaches.
      :param onnx_nodes: the onnx node list in onnx model.
      :param opset opset: number of the model
      :param nchw_inputs: the name list of the inputs needed to be transposed as NCHW
      :param inputs: the model input
      :param outputs: the model output
      :return: the optimized onnx node list