Closed busFred closed 3 years ago
Let me know if PR #680 addresses your issue. It fixes normalization with norm L2 and double. If the shape is unexpected, it is possible to reshape before and after. onnx allows reshape with -1. Reshape(M, (-1, 4)) reshapes M with 4 columns and the corresponding number of rows.
I can now normalize input with OnnxSubEstimator(Normalizer(norm="l2"), normalize_op, op_versionrow_norms=op_version)
. But using native ai.onnx.ml.Normalizer OnnxNormalizer(input, norm="L2", op_version=op_version)
still generates the shape error.
I think PR #680 solve my problem for now, but eventually I still want to migrate to native ai.onnx.ml.Normalizer
Native Normalizer does not support double and is very strict about input shapes: Normalizer. That's why the converter switches to matrix operations.
As I suggested in #678, the the converter for
sklearn.preprocessing.Normalizer
does not support double type. So I switch to useskl2onnx.algebra.onnx_ops.Normalizer
. I guess thatskl2onnx.algebra.onnx_ops.Normalizer
is a wrapperskl2onnx.algebra.onnx_ops.Normalizer
aroundai.onnx.ml.Normalizer
However, on the documentation forai.onnx.ml.Normalizer
, it is clearly suggested that the input X can be a tensor of shape [N,C] or [C]. But when I apply the following code in the converter function:And then run the transformer with the following:
It spits out the following error:
To investigate the error, I print out the sample dummy input X I send to the
to_onnx
function:and it prints out