File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ to automatically check every converter with
5555 from onnxmltools import convert_sklearn
5656 from onnxmltools.utils import save_model
5757 from onnxconverter_common.data_types import FloatTensorType
58- initial_type = [('float_input', FloatTensorType([1, 4]))]
58+ initial_type = [('float_input', FloatTensorType([- 1, 4]))]
5959 onx = convert_sklearn(clr, initial_types=initial_type)
6060 save_model(onx, "rf_iris.onnx")
6161
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ to convert other model formats into ONNX. Here we will use
5454 from onnxmltools.utils import save_model
5555 from onnxmltools.convert.common.data_types import FloatTensorType
5656
57- initial_type = [('float_input', FloatTensorType([1, 4]))]
57+ initial_type = [('float_input', FloatTensorType([- 1, 4]))]
5858 onx = convert_sklearn(clr, initial_types=initial_type)
5959 save_model(onx, "logreg_iris.onnx")
6060
@@ -67,7 +67,9 @@ for this machine learning model.
6767::
6868
6969 import onnxruntime as rt
70+ import numpy
7071 sess = rt.InferenceSession("logreg_iris.onnx")
72+ label_name = sess.get_outputs()[0].name
7173 input_name = sess.get_inputs()[0].name
7274
7375 pred_onx = sess.run([label_name], {input_name: X_test.astype(numpy.float32)})[0]
You can’t perform that action at this time.
0 commit comments