We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
AttributeError: 'numpy.uintXX' object has no attribute 'encode'
Hi Team,

Found an issue similar to #476, but for sklearn.neural_network.MLPClassifier objects.
Any model trained using an unsigned integer output type fails to be converted. See below a script to reproduce the issue:
```
import numpy as np
from sklearn.neural_network import MLPClassifier
from skl2onnx import convert_sklearn
from skl2onnx.common.data_types import FloatTensorType

rettype = np.uint32
nbclasses = 4
nrattribs = 3
nrpts = 10

x_train = np.random.random_sample( (nrpts,nrattribs) ).astype( np.single )
y_train = (x_train[:,0].copy() * nbclasses ).astype( rettype )

model = MLPClassifier()
model.fit( x_train, y_train )

initial_type = [('float_input', FloatTensorType([None,nrattribs]))]
onnxmodel = convert_sklearn(model, initial_types=initial_type)
```
The conversion fails for rettype = np.uint8, np.uint16 and np.uint32, but not for signed integer types or floating-point types.
A workaround can be to modify the model output type after training, before calling convert_sklearn:
`model.classes_ = model.classes_.astype( np.int32 )`

Tested with Python 3.9, scikit-learn v1.0.1, skl2onnx v1.10.3


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `skl2onnx/operator_converters/multilayer_perceptron.py`
Content:
```
1 # SPDX-License-Identifier: Apache-2.0
2 
3 
4 import numpy as np
5 from ..common.data_types import guess_proto_type
6 from ..common._apply_operation import (
7     apply_add, apply_cast, apply_concat, apply_identity,
8     apply_reshape, apply_sub)
9 from ..common._registration import register_converter
10 from ..common._topology import Scope, Operator
11 from ..common._container import ModelComponentContainer
12 from ..proto import onnx_proto
13 
14 
15 def _forward_pass(scope, container, model, activations, proto_dtype):
16     """
17     Perform a forward pass on the network by computing the values of
18     the neurons in the hidden layers and the output layer.
19     """
20     activations_map = {
21         'identity': 'Identity', 'tanh': 'Tanh', 'logistic': 'Sigmoid',
22         'relu': 'Relu', 'softmax': 'Softmax'
23     }
24 
25     out_activation_result_name = scope.get_unique_variable_name(
26         'out_activations_result')
27 
28     # Iterate over the hidden layers
29     for i in range(model.n_layers_ - 1):
30         coefficient_name = scope.get_unique_variable_name('coefficient')
31         intercepts_name = scope.get_unique_variable_name('intercepts')
32         mul_result_name = scope.get_unique_variable_name('mul_result')
33         add_result_name = scope.get_unique_variable_name('add_result')
34 
35         container.add_initializer(
36             coefficient_name, proto_dtype,
37             model.coefs_[i].shape, model.coefs_[i].ravel())
38         container.add_initializer(
39             intercepts_name, proto_dtype,
40             [1, len(model.intercepts_[i])], model.intercepts_[i])
41 
42         container.add_node(
43             'MatMul', [activations[i], coefficient_name],
44             mul_result_name, name=scope.get_unique_operator_name('MatMul'))
45         apply_add(scope, [mul_result_name, intercepts_name],
46                   add_result_name, container, broadcast=1)
47 
48         # For the hidden layers
49         if (i + 1) != (model.n_layers_ - 1):
50             activations_result_name = scope.get_unique_variable_name(
51                 'next_activations')
52 
53             container.add_node(
54                 activations_map[model.activation], add_result_name,
55                 activations_result_name,
56                 name=scope.get_unique_operator_name(
57                     activations_map[model.activation]))
58             activations.append(activations_result_name)
59 
60     # For the last layer
61     container.add_node(
62         activations_map[model.out_activation_], add_result_name,
63         out_activation_result_name,
64         name=scope.get_unique_operator_name(activations_map[model.activation]))
65     activations.append(out_activation_result_name)
66 
67     return activations
68 
69 
70 def _predict(scope, input_name, container, model, proto_dtype):
71     """
72     This function initialises the input layer, calls _forward_pass()
73     and returns the final layer.
74     """
75     cast_input_name = scope.get_unique_variable_name('cast_input')
76 
77     apply_cast(scope, input_name, cast_input_name,
78                container, to=proto_dtype)
79 
80     # forward propagate
81     activations = _forward_pass(scope, container, model, [cast_input_name],
82                                 proto_dtype)
83     return activations[-1]
84 
85 
86 def convert_sklearn_mlp_classifier(scope: Scope, operator: Operator,
87                                    container: ModelComponentContainer):
88     """
89     Converter for MLPClassifier.
90     This function calls _predict() which returns the probability scores
91     of the positive class in case of binary labels and class
92     probabilities in case of multi-class. It then calculates probability
93     scores for the negative class in case of binary labels. It
94     calculates the class labels and sets the output.
95     """
96     mlp_op = operator.raw_operator
97     classes = mlp_op.classes_
98     class_type = onnx_proto.TensorProto.STRING
99 
100     argmax_output_name = scope.get_unique_variable_name('argmax_output')
101     array_feature_extractor_result_name = scope.get_unique_variable_name(
102         'array_feature_extractor_result')
103 
104     proto_dtype = guess_proto_type(operator.inputs[0].type)
105     if proto_dtype != onnx_proto.TensorProto.DOUBLE:
106         proto_dtype = onnx_proto.TensorProto.FLOAT
107 
108     y_pred = _predict(scope, operator.inputs[0].full_name, container, mlp_op,
109                       proto_dtype)
110 
111     if np.issubdtype(mlp_op.classes_.dtype, np.floating):
112         class_type = onnx_proto.TensorProto.INT32
113         classes = classes.astype(np.int32)
114     elif np.issubdtype(mlp_op.classes_.dtype, np.signedinteger):
115         class_type = onnx_proto.TensorProto.INT32
116     else:
117         classes = np.array([s.encode('utf-8') for s in classes])
118 
119     if len(classes) == 2:
120         unity_name = scope.get_unique_variable_name('unity')
121         negative_class_proba_name = scope.get_unique_variable_name(
122             'negative_class_proba')
123         container.add_initializer(unity_name, proto_dtype, [], [1])
124         apply_sub(scope, [unity_name, y_pred],
125                   negative_class_proba_name, container, broadcast=1)
126         apply_concat(scope, [negative_class_proba_name, y_pred],
127                      operator.outputs[1].full_name, container, axis=1)
128     else:
129         apply_identity(scope, y_pred,
130                        operator.outputs[1].full_name, container)
131 
132     if mlp_op._label_binarizer.y_type_ == 'multilabel-indicator':
133         binariser_output_name = scope.get_unique_variable_name(
134             'binariser_output')
135 
136         container.add_node('Binarizer', y_pred, binariser_output_name,
137                            threshold=0.5, op_domain='ai.onnx.ml')
138         apply_cast(
139             scope, binariser_output_name, operator.outputs[0].full_name,
140             container, to=onnx_proto.TensorProto.INT64)
141     else:
142         classes_name = scope.get_unique_variable_name('classes')
143         container.add_initializer(classes_name, class_type,
144                                   classes.shape, classes)
145 
146         container.add_node('ArgMax', operator.outputs[1].full_name,
147                            argmax_output_name, axis=1,
148                            name=scope.get_unique_operator_name('ArgMax'))
149         container.add_node(
150             'ArrayFeatureExtractor', [classes_name, argmax_output_name],
151             array_feature_extractor_result_name, op_domain='ai.onnx.ml',
152             name=scope.get_unique_operator_name('ArrayFeatureExtractor'))
153 
154         if class_type == onnx_proto.TensorProto.INT32:
155             reshaped_result_name = scope.get_unique_variable_name(
156                 'reshaped_result')
157 
158             apply_reshape(scope, array_feature_extractor_result_name,
159                           reshaped_result_name, container,
160                           desired_shape=(-1,))
161             apply_cast(
162                 scope, reshaped_result_name, operator.outputs[0].full_name,
163                 container, to=onnx_proto.TensorProto.INT64)
164         else:
165             apply_reshape(scope, array_feature_extractor_result_name,
166                           operator.outputs[0].full_name, container,
167                           desired_shape=(-1,))
168 
169 
170 def convert_sklearn_mlp_regressor(scope: Scope, operator: Operator,
171                                   container: ModelComponentContainer):
172     """
173     Converter for MLPRegressor.
174     This function calls _predict() which returns the scores.
175     """
176     mlp_op = operator.raw_operator
177 
178     proto_dtype = guess_proto_type(operator.inputs[0].type)
179     if proto_dtype != onnx_proto.TensorProto.DOUBLE:
180         proto_dtype = onnx_proto.TensorProto.FLOAT
181 
182     y_pred = _predict(scope, operator.inputs[0].full_name, container, mlp_op,
183                       proto_dtype=proto_dtype)
184     apply_reshape(scope, y_pred, operator.output_full_names,
185                   container, desired_shape=(-1, 1))
186 
187 
188 register_converter('SklearnMLPClassifier',
189                    convert_sklearn_mlp_classifier,
190                    options={'zipmap': [True, False, 'columns'],
191                             'output_class_labels': [False, True],
192                             'nocl': [True, False]})
193 register_converter('SklearnMLPRegressor',
194                    convert_sklearn_mlp_regressor)
195
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/skl2onnx/operator_converters/multilayer_perceptron.py b/skl2onnx/operator_converters/multilayer_perceptron.py
--- a/skl2onnx/operator_converters/multilayer_perceptron.py
+++ b/skl2onnx/operator_converters/multilayer_perceptron.py
@@ -111,7 +111,7 @@
     if np.issubdtype(mlp_op.classes_.dtype, np.floating):
         class_type = onnx_proto.TensorProto.INT32
         classes = classes.astype(np.int32)
-    elif np.issubdtype(mlp_op.classes_.dtype, np.signedinteger):
+    elif np.issubdtype(mlp_op.classes_.dtype, np.integer):
         class_type = onnx_proto.TensorProto.INT32
     else:
         classes = np.array([s.encode('utf-8') for s in classes])

{"golden_diff": "diff --git a/skl2onnx/operator_converters/multilayer_perceptron.py b/skl2onnx/operator_converters/multilayer_perceptron.py\n--- a/skl2onnx/operator_converters/multilayer_perceptron.py\n+++ b/skl2onnx/operator_converters/multilayer_perceptron.py\n@@ -111,7 +111,7 @@\n     if np.issubdtype(mlp_op.classes_.dtype, np.floating):\n         class_type = onnx_proto.TensorProto.INT32\n         classes = classes.astype(np.int32)\n-    elif np.issubdtype(mlp_op.classes_.dtype, np.signedinteger):\n+    elif np.issubdtype(mlp_op.classes_.dtype, np.integer):\n         class_type = onnx_proto.TensorProto.INT32\n     else:\n         classes = np.array([s.encode('utf-8') for s in classes])\n", "issue": "AttributeError: 'numpy.uintXX' object has no attribute 'encode'\nHi Team,\r\n\r\nFound an issue similar to #476, but for sklearn.neural_network.MLPClassifier objects.\r\nAny model trained using an unsigned integer output type fails to be converted. See below a script to reproduce the issue:\r\n```\r\nimport numpy as np\r\nfrom sklearn.neural_network import MLPClassifier\r\nfrom skl2onnx import convert_sklearn\r\nfrom skl2onnx.common.data_types import FloatTensorType\r\n\r\nrettype = np.uint32\r\nnbclasses = 4\r\nnrattribs = 3\r\nnrpts = 10\r\n\r\nx_train = np.random.random_sample( (nrpts,nrattribs) ).astype( np.single )\r\ny_train = (x_train[:,0].copy() * nbclasses ).astype( rettype )\r\n\r\nmodel = MLPClassifier()\r\nmodel.fit( x_train, y_train )\r\n\r\ninitial_type = [('float_input', FloatTensorType([None,nrattribs]))]\r\nonnxmodel = convert_sklearn(model, initial_types=initial_type)\r\n```\r\nThe conversion fails for rettype = np.uint8, np.uint16 and np.uint32, but not for signed integer types or floating-point types.\r\nA workaround can be to modify the model output type after training, before calling convert_sklearn:\r\n`model.classes_ = model.classes_.astype( np.int32 )`\r\n\r\nTested with Python 3.9, scikit-learn v1.0.1, skl2onnx v1.10.3\r\n\n", "before_files": [{"content": "# SPDX-License-Identifier: Apache-2.0\n\n\nimport numpy as np\nfrom ..common.data_types import guess_proto_type\nfrom ..common._apply_operation import (\n    apply_add, apply_cast, apply_concat, apply_identity,\n    apply_reshape, apply_sub)\nfrom ..common._registration import register_converter\nfrom ..common._topology import Scope, Operator\nfrom ..common._container import ModelComponentContainer\nfrom ..proto import onnx_proto\n\n\ndef _forward_pass(scope, container, model, activations, proto_dtype):\n    \"\"\"\n    Perform a forward pass on the network by computing the values of\n    the neurons in the hidden layers and the output layer.\n    \"\"\"\n    activations_map = {\n        'identity': 'Identity', 'tanh': 'Tanh', 'logistic': 'Sigmoid',\n        'relu': 'Relu', 'softmax': 'Softmax'\n    }\n\n    out_activation_result_name = scope.get_unique_variable_name(\n        'out_activations_result')\n\n    # Iterate over the hidden layers\n    for i in range(model.n_layers_ - 1):\n        coefficient_name = scope.get_unique_variable_name('coefficient')\n        intercepts_name = scope.get_unique_variable_name('intercepts')\n        mul_result_name = scope.get_unique_variable_name('mul_result')\n        add_result_name = scope.get_unique_variable_name('add_result')\n\n        container.add_initializer(\n            coefficient_name, proto_dtype,\n            model.coefs_[i].shape, model.coefs_[i].ravel())\n        container.add_initializer(\n            intercepts_name, proto_dtype,\n            [1, len(model.intercepts_[i])], model.intercepts_[i])\n\n        container.add_node(\n            'MatMul', [activations[i], coefficient_name],\n            mul_result_name, name=scope.get_unique_operator_name('MatMul'))\n        apply_add(scope, [mul_result_name, intercepts_name],\n                  add_result_name, container, broadcast=1)\n\n        # For the hidden layers\n        if (i + 1) != (model.n_layers_ - 1):\n            activations_result_name = scope.get_unique_variable_name(\n                'next_activations')\n\n            container.add_node(\n                activations_map[model.activation], add_result_name,\n                activations_result_name,\n                name=scope.get_unique_operator_name(\n                    activations_map[model.activation]))\n            activations.append(activations_result_name)\n\n    # For the last layer\n    container.add_node(\n        activations_map[model.out_activation_], add_result_name,\n        out_activation_result_name,\n        name=scope.get_unique_operator_name(activations_map[model.activation]))\n    activations.append(out_activation_result_name)\n\n    return activations\n\n\ndef _predict(scope, input_name, container, model, proto_dtype):\n    \"\"\"\n    This function initialises the input layer, calls _forward_pass()\n    and returns the final layer.\n    \"\"\"\n    cast_input_name = scope.get_unique_variable_name('cast_input')\n\n    apply_cast(scope, input_name, cast_input_name,\n               container, to=proto_dtype)\n\n    # forward propagate\n    activations = _forward_pass(scope, container, model, [cast_input_name],\n                                proto_dtype)\n    return activations[-1]\n\n\ndef convert_sklearn_mlp_classifier(scope: Scope, operator: Operator,\n                                   container: ModelComponentContainer):\n    \"\"\"\n    Converter for MLPClassifier.\n    This function calls _predict() which returns the probability scores\n    of the positive class in case of binary labels and class\n    probabilities in case of multi-class. It then calculates probability\n    scores for the negative class in case of binary labels. It\n    calculates the class labels and sets the output.\n    \"\"\"\n    mlp_op = operator.raw_operator\n    classes = mlp_op.classes_\n    class_type = onnx_proto.TensorProto.STRING\n\n    argmax_output_name = scope.get_unique_variable_name('argmax_output')\n    array_feature_extractor_result_name = scope.get_unique_variable_name(\n        'array_feature_extractor_result')\n\n    proto_dtype = guess_proto_type(operator.inputs[0].type)\n    if proto_dtype != onnx_proto.TensorProto.DOUBLE:\n        proto_dtype = onnx_proto.TensorProto.FLOAT\n\n    y_pred = _predict(scope, operator.inputs[0].full_name, container, mlp_op,\n                      proto_dtype)\n\n    if np.issubdtype(mlp_op.classes_.dtype, np.floating):\n        class_type = onnx_proto.TensorProto.INT32\n        classes = classes.astype(np.int32)\n    elif np.issubdtype(mlp_op.classes_.dtype, np.signedinteger):\n        class_type = onnx_proto.TensorProto.INT32\n    else:\n        classes = np.array([s.encode('utf-8') for s in classes])\n\n    if len(classes) == 2:\n        unity_name = scope.get_unique_variable_name('unity')\n        negative_class_proba_name = scope.get_unique_variable_name(\n            'negative_class_proba')\n        container.add_initializer(unity_name, proto_dtype, [], [1])\n        apply_sub(scope, [unity_name, y_pred],\n                  negative_class_proba_name, container, broadcast=1)\n        apply_concat(scope, [negative_class_proba_name, y_pred],\n                     operator.outputs[1].full_name, container, axis=1)\n    else:\n        apply_identity(scope, y_pred,\n                       operator.outputs[1].full_name, container)\n\n    if mlp_op._label_binarizer.y_type_ == 'multilabel-indicator':\n        binariser_output_name = scope.get_unique_variable_name(\n            'binariser_output')\n\n        container.add_node('Binarizer', y_pred, binariser_output_name,\n                           threshold=0.5, op_domain='ai.onnx.ml')\n        apply_cast(\n            scope, binariser_output_name, operator.outputs[0].full_name,\n            container, to=onnx_proto.TensorProto.INT64)\n    else:\n        classes_name = scope.get_unique_variable_name('classes')\n        container.add_initializer(classes_name, class_type,\n                                  classes.shape, classes)\n\n        container.add_node('ArgMax', operator.outputs[1].full_name,\n                           argmax_output_name, axis=1,\n                           name=scope.get_unique_operator_name('ArgMax'))\n        container.add_node(\n            'ArrayFeatureExtractor', [classes_name, argmax_output_name],\n            array_feature_extractor_result_name, op_domain='ai.onnx.ml',\n            name=scope.get_unique_operator_name('ArrayFeatureExtractor'))\n\n        if class_type == onnx_proto.TensorProto.INT32:\n            reshaped_result_name = scope.get_unique_variable_name(\n                'reshaped_result')\n\n            apply_reshape(scope, array_feature_extractor_result_name,\n                          reshaped_result_name, container,\n                          desired_shape=(-1,))\n            apply_cast(\n                scope, reshaped_result_name, operator.outputs[0].full_name,\n                container, to=onnx_proto.TensorProto.INT64)\n        else:\n            apply_reshape(scope, array_feature_extractor_result_name,\n                          operator.outputs[0].full_name, container,\n                          desired_shape=(-1,))\n\n\ndef convert_sklearn_mlp_regressor(scope: Scope, operator: Operator,\n                                  container: ModelComponentContainer):\n    \"\"\"\n    Converter for MLPRegressor.\n    This function calls _predict() which returns the scores.\n    \"\"\"\n    mlp_op = operator.raw_operator\n\n    proto_dtype = guess_proto_type(operator.inputs[0].type)\n    if proto_dtype != onnx_proto.TensorProto.DOUBLE:\n        proto_dtype = onnx_proto.TensorProto.FLOAT\n\n    y_pred = _predict(scope, operator.inputs[0].full_name, container, mlp_op,\n                      proto_dtype=proto_dtype)\n    apply_reshape(scope, y_pred, operator.output_full_names,\n                  container, desired_shape=(-1, 1))\n\n\nregister_converter('SklearnMLPClassifier',\n                   convert_sklearn_mlp_classifier,\n                   options={'zipmap': [True, False, 'columns'],\n                            'output_class_labels': [False, True],\n                            'nocl': [True, False]})\nregister_converter('SklearnMLPRegressor',\n                   convert_sklearn_mlp_regressor)\n", "path": "skl2onnx/operator_converters/multilayer_perceptron.py"}], "after_files": [{"content": "# SPDX-License-Identifier: Apache-2.0\n\n\nimport numpy as np\nfrom ..common.data_types import guess_proto_type\nfrom ..common._apply_operation import (\n    apply_add, apply_cast, apply_concat, apply_identity,\n    apply_reshape, apply_sub)\nfrom ..common._registration import register_converter\nfrom ..common._topology import Scope, Operator\nfrom ..common._container import ModelComponentContainer\nfrom ..proto import onnx_proto\n\n\ndef _forward_pass(scope, container, model, activations, proto_dtype):\n    \"\"\"\n    Perform a forward pass on the network by computing the values of\n    the neurons in the hidden layers and the output layer.\n    \"\"\"\n    activations_map = {\n        'identity': 'Identity', 'tanh': 'Tanh', 'logistic': 'Sigmoid',\n        'relu': 'Relu', 'softmax': 'Softmax'\n    }\n\n    out_activation_result_name = scope.get_unique_variable_name(\n        'out_activations_result')\n\n    # Iterate over the hidden layers\n    for i in range(model.n_layers_ - 1):\n        coefficient_name = scope.get_unique_variable_name('coefficient')\n        intercepts_name = scope.get_unique_variable_name('intercepts')\n        mul_result_name = scope.get_unique_variable_name('mul_result')\n        add_result_name = scope.get_unique_variable_name('add_result')\n\n        container.add_initializer(\n            coefficient_name, proto_dtype,\n            model.coefs_[i].shape, model.coefs_[i].ravel())\n        container.add_initializer(\n            intercepts_name, proto_dtype,\n            [1, len(model.intercepts_[i])], model.intercepts_[i])\n\n        container.add_node(\n            'MatMul', [activations[i], coefficient_name],\n            mul_result_name, name=scope.get_unique_operator_name('MatMul'))\n        apply_add(scope, [mul_result_name, intercepts_name],\n                  add_result_name, container, broadcast=1)\n\n        # For the hidden layers\n        if (i + 1) != (model.n_layers_ - 1):\n            activations_result_name = scope.get_unique_variable_name(\n                'next_activations')\n\n            container.add_node(\n                activations_map[model.activation], add_result_name,\n                activations_result_name,\n                name=scope.get_unique_operator_name(\n                    activations_map[model.activation]))\n            activations.append(activations_result_name)\n\n    # For the last layer\n    container.add_node(\n        activations_map[model.out_activation_], add_result_name,\n        out_activation_result_name,\n        name=scope.get_unique_operator_name(activations_map[model.activation]))\n    activations.append(out_activation_result_name)\n\n    return activations\n\n\ndef _predict(scope, input_name, container, model, proto_dtype):\n    \"\"\"\n    This function initialises the input layer, calls _forward_pass()\n    and returns the final layer.\n    \"\"\"\n    cast_input_name = scope.get_unique_variable_name('cast_input')\n\n    apply_cast(scope, input_name, cast_input_name,\n               container, to=proto_dtype)\n\n    # forward propagate\n    activations = _forward_pass(scope, container, model, [cast_input_name],\n                                proto_dtype)\n    return activations[-1]\n\n\ndef convert_sklearn_mlp_classifier(scope: Scope, operator: Operator,\n                                   container: ModelComponentContainer):\n    \"\"\"\n    Converter for MLPClassifier.\n    This function calls _predict() which returns the probability scores\n    of the positive class in case of binary labels and class\n    probabilities in case of multi-class. It then calculates probability\n    scores for the negative class in case of binary labels. It\n    calculates the class labels and sets the output.\n    \"\"\"\n    mlp_op = operator.raw_operator\n    classes = mlp_op.classes_\n    class_type = onnx_proto.TensorProto.STRING\n\n    argmax_output_name = scope.get_unique_variable_name('argmax_output')\n    array_feature_extractor_result_name = scope.get_unique_variable_name(\n        'array_feature_extractor_result')\n\n    proto_dtype = guess_proto_type(operator.inputs[0].type)\n    if proto_dtype != onnx_proto.TensorProto.DOUBLE:\n        proto_dtype = onnx_proto.TensorProto.FLOAT\n\n    y_pred = _predict(scope, operator.inputs[0].full_name, container, mlp_op,\n                      proto_dtype)\n\n    if np.issubdtype(mlp_op.classes_.dtype, np.floating):\n        class_type = onnx_proto.TensorProto.INT32\n        classes = classes.astype(np.int32)\n    elif np.issubdtype(mlp_op.classes_.dtype, np.integer):\n        class_type = onnx_proto.TensorProto.INT32\n    else:\n        classes = np.array([s.encode('utf-8') for s in classes])\n\n    if len(classes) == 2:\n        unity_name = scope.get_unique_variable_name('unity')\n        negative_class_proba_name = scope.get_unique_variable_name(\n            'negative_class_proba')\n        container.add_initializer(unity_name, proto_dtype, [], [1])\n        apply_sub(scope, [unity_name, y_pred],\n                  negative_class_proba_name, container, broadcast=1)\n        apply_concat(scope, [negative_class_proba_name, y_pred],\n                     operator.outputs[1].full_name, container, axis=1)\n    else:\n        apply_identity(scope, y_pred,\n                       operator.outputs[1].full_name, container)\n\n    if mlp_op._label_binarizer.y_type_ == 'multilabel-indicator':\n        binariser_output_name = scope.get_unique_variable_name(\n            'binariser_output')\n\n        container.add_node('Binarizer', y_pred, binariser_output_name,\n                           threshold=0.5, op_domain='ai.onnx.ml')\n        apply_cast(\n            scope, binariser_output_name, operator.outputs[0].full_name,\n            container, to=onnx_proto.TensorProto.INT64)\n    else:\n        classes_name = scope.get_unique_variable_name('classes')\n        container.add_initializer(classes_name, class_type,\n                                  classes.shape, classes)\n\n        container.add_node('ArgMax', operator.outputs[1].full_name,\n                           argmax_output_name, axis=1,\n                           name=scope.get_unique_operator_name('ArgMax'))\n        container.add_node(\n            'ArrayFeatureExtractor', [classes_name, argmax_output_name],\n            array_feature_extractor_result_name, op_domain='ai.onnx.ml',\n            name=scope.get_unique_operator_name('ArrayFeatureExtractor'))\n\n        if class_type == onnx_proto.TensorProto.INT32:\n            reshaped_result_name = scope.get_unique_variable_name(\n                'reshaped_result')\n\n            apply_reshape(scope, array_feature_extractor_result_name,\n                          reshaped_result_name, container,\n                          desired_shape=(-1,))\n            apply_cast(\n                scope, reshaped_result_name, operator.outputs[0].full_name,\n                container, to=onnx_proto.TensorProto.INT64)\n        else:\n            apply_reshape(scope, array_feature_extractor_result_name,\n                          operator.outputs[0].full_name, container,\n                          desired_shape=(-1,))\n\n\ndef convert_sklearn_mlp_regressor(scope: Scope, operator: Operator,\n                                  container: ModelComponentContainer):\n    \"\"\"\n    Converter for MLPRegressor.\n    This function calls _predict() which returns the scores.\n    \"\"\"\n    mlp_op = operator.raw_operator\n\n    proto_dtype = guess_proto_type(operator.inputs[0].type)\n    if proto_dtype != onnx_proto.TensorProto.DOUBLE:\n        proto_dtype = onnx_proto.TensorProto.FLOAT\n\n    y_pred = _predict(scope, operator.inputs[0].full_name, container, mlp_op,\n                      proto_dtype=proto_dtype)\n    apply_reshape(scope, y_pred, operator.output_full_names,\n                  container, desired_shape=(-1, 1))\n\n\nregister_converter('SklearnMLPClassifier',\n                   convert_sklearn_mlp_classifier,\n                   options={'zipmap': [True, False, 'columns'],\n                            'output_class_labels': [False, True],\n                            'nocl': [True, False]})\nregister_converter('SklearnMLPRegressor',\n                   convert_sklearn_mlp_regressor)\n", "path": "skl2onnx/operator_converters/multilayer_perceptron.py"}]}