Skip to content

Commit bf98384

Browse files
authored
Better comments (#84)
* better comments * status
1 parent 53506d1 commit bf98384

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

_doc/examples/plot_benchmark_rf.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import numpy
2323
import pandas
2424
from lightgbm import LGBMRegressor
25-
from onnxmltools.convert.lightgbm.operator_converters.LightGbm import convert_lightgbm
26-
from onnxmltools.convert.xgboost.operator_converters.XGBoost import convert_xgboost
2725
from onnxruntime import InferenceSession, SessionOptions
2826
from psutil import cpu_count
2927
from sphinx_runpython.runpython import run_cmd
@@ -33,9 +31,14 @@
3331
from sklearn.ensemble import RandomForestRegressor
3432
from tqdm import tqdm
3533
from xgboost import XGBRegressor
34+
from onnxmltools.convert.xgboost.operator_converters.XGBoost import convert_xgboost
3635

3736

3837
def skl2onnx_convert_lightgbm(scope, operator, container):
38+
from onnxmltools.convert.lightgbm.operator_converters.LightGbm import (
39+
convert_lightgbm,
40+
)
41+
3942
options = scope.get_options(operator.raw_operator)
4043
if "split" in options:
4144
operator.split = options["split"]

onnx_array_api/_command_lines_parser.py

+6
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,14 @@ def _cmd_compare(argv: List[Any]):
123123

124124
parser = get_parser_compare()
125125
args = parser.parse_args(argv[1:])
126+
if args.verbose in ("1", 1, "True", True):
127+
print(f"[compare] first model {args.model1!r}")
128+
print(f"[compare] second model {args.model2!r}")
126129
onx1 = onnx.load(args.model1)
127130
onx2 = onnx.load(args.model2)
131+
if args.verbose in ("1", 1, "True", True):
132+
print(f"[compare] first model has {len(onx1.graph.node)} nodes")
133+
print(f"[compare] second model has {len(onx2.graph.node)} nodes")
128134
res1, res2, align, dc = compare_onnx_execution(
129135
onx1,
130136
onx2,

onnx_array_api/reference/evaluator_yield.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -642,15 +642,16 @@ def compare_onnx_execution(
642642
print("[compare_onnx_execution] loading first model")
643643
proto1 = load(model1) if isinstance(model1, str) else model1
644644
if verbose:
645-
print("[compare_onnx_execution] loading first model")
645+
print("[compare_onnx_execution] loading second model")
646646
proto2 = load(model2) if isinstance(model2, str) else model2
647647
res1 = list(_enumerate_result_no_execution(proto1))
648648
res2 = list(_enumerate_result_no_execution(proto2))
649649
else:
650650
return
651651

652652
if verbose:
653-
print(f"[compare_onnx_execution] got {len(res2)} results")
653+
print(f"[compare_onnx_execution] got {len(res1)} results (first model)")
654+
print(f"[compare_onnx_execution] got {len(res2)} results (second model)")
654655
print("[compare_onnx_execution] compute edit distance")
655656
dc = DistanceExecution()
656657
_, align = dc.distance_sequence(res1, res2)

0 commit comments

Comments
 (0)