diff --git a/docs/examples/plot_cast_transformer.py b/docs/examples/plot_cast_transformer.py index 34efc74f8..82cfef35e 100644 --- a/docs/examples/plot_cast_transformer.py +++ b/docs/examples/plot_cast_transformer.py @@ -30,7 +30,6 @@ """ import onnxruntime import onnx -import numpy import os import math import numpy as np diff --git a/docs/examples/plot_tfidfvectorizer.py b/docs/examples/plot_tfidfvectorizer.py index 96321bfbf..290eb5e36 100644 --- a/docs/examples/plot_tfidfvectorizer.py +++ b/docs/examples/plot_tfidfvectorizer.py @@ -24,7 +24,6 @@ import matplotlib.pyplot as plt import os from onnx.tools.net_drawer import GetPydotGraph, GetOpNodeProducer -import numpy import onnxruntime as rt from skl2onnx.common.data_types import StringTensorType from skl2onnx import convert_sklearn diff --git a/tests/test_sklearn_classifiers_extreme.py b/tests/test_sklearn_classifiers_extreme.py index 8996aeaf9..d26ca31a5 100644 --- a/tests/test_sklearn_classifiers_extreme.py +++ b/tests/test_sklearn_classifiers_extreme.py @@ -2,7 +2,11 @@ import unittest import numpy as np -from onnx.reference import ReferenceEvaluator + +try: + from onnx.reference import ReferenceEvaluator +except ImportError: + ReferenceEvaluator = None from sklearn.tree import DecisionTreeClassifier from onnxruntime import InferenceSession from skl2onnx import to_onnx @@ -21,11 +25,15 @@ def test_one_training_class(self): onx = to_onnx(cl, x, target_opset=TARGET_OPSET, options={"zipmap": False}) for cls in [ - lambda onx: ReferenceEvaluator(onx, verbose=0), + (lambda onx: ReferenceEvaluator(onx, verbose=0)) + if ReferenceEvaluator is not None + else None, lambda onx: InferenceSession( onx.SerializeToString(), providers=["CPUExecutionProvider"] ), ]: + if cls is None: + continue sess = cls(onx) res = sess.run(None, {"X": x}) self.assertEqual(len(res), len(expected))