Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label binariser converter doesn't work on 2-D data #229

Closed
prabhat00155 opened this issue Aug 7, 2019 · 0 comments
Closed

Label binariser converter doesn't work on 2-D data #229

prabhat00155 opened this issue Aug 7, 2019 · 0 comments
Labels
Projects

Comments

@prabhat00155
Copy link
Contributor

X1 = np.array([[0, 1, 1], [1, 0, 0]])
model = LabelBinarizer().fit(X1)
print(model.transform(X1))

onnx_fs = convert_sklearn(model, 'lb', [('float_input', Int64TensorType(X1.shape))])
onnxmltools.utils.save_model(onnx_fs, 'lb.onnx')
sess = InferenceSession('lb.onnx')
res = sess.run('', input_feed={'float_input': X1.astype(np.int64)})
res

[[0 1 1]
[1 0 0]]

RuntimeError Traceback (most recent call last)
in
5 onnx_fs = convert_sklearn(model, 'lb', [('float_input', Int64TensorType(X1.shape))])
6 onnxmltools.utils.save_model(onnx_fs, 'lb.onnx')
----> 7 sess = InferenceSession('lb.onnx')
8 res = sess.run('', input_feed={'float_input': X1.astype(np.int64)})
9 res

~/Documents/MachineLearning/onnx_projects/onnx_env/lib/python3.6/site-packages/onnxruntime/capi/session.py in init(self, path_or_bytes, sess_options)
27
28 if isinstance(path_or_bytes, str):
---> 29 self._sess.load_model(path_or_bytes)
30 elif isinstance(path_or_bytes, bytes):
31 self._sess.read_bytes(path_or_bytes)

RuntimeError: [ONNXRuntimeError] : 1 : GENERAL ERROR : Load model from lb.onnx failed:Node:Cast Output:variable [ShapeInferenceError] Can't merge shape info. Both source and target dimension have values but they differ. Source=6 Target=2 Dimension=0

@xadupre xadupre added the 0.23 label Apr 24, 2020
@xadupre xadupre added this to To do in August 2020 Apr 24, 2020
@xadupre xadupre moved this from To do to In progress in August 2020 Apr 29, 2020
@xadupre xadupre moved this from In progress to Done in August 2020 Apr 30, 2020
@xadupre xadupre moved this from Done to In progress in August 2020 Jul 2, 2020
@xadupre xadupre moved this from In progress to Done in August 2020 Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
August 2020
  
Done
Development

No branches or pull requests

2 participants