prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  SelectFromModel converted model with threshold such that no features selected give error
  SelectFromModel model in Scikit with threshold such that no features are selected returns an array of shape (M, 0), where M is the number of test instances, onnx converter however can't handle it.
  
  RuntimeError: [ONNXRuntimeError] : 1 : GENERAL ERROR : Load model from pca1.onnx failed:[ShapeInferenceError] Shape input must be a one-dimensional tensor. 
  
  --- 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/feature_selection.py`
  Content:
  ```
  1 # -------------------------------------------------------------------------
  2 # Copyright (c) Microsoft Corporation. All rights reserved.
  3 # Licensed under the MIT License. See License.txt in the project root for
  4 # license information.
  5 # --------------------------------------------------------------------------
  6 
  7 from ..proto import onnx_proto
  8 from ..common._apply_operation import apply_cast
  9 from ..common._registration import register_converter
  10 from ..common.data_types import FloatTensorType, FloatType
  11 
  12 
  13 def convert_sklearn_feature_selection(scope, operator, container):
  14     op = operator.raw_operator
  15     # Get indices of the features selected
  16     index = op.get_support(indices=True)
  17     needs_cast = not isinstance(operator.inputs[0].type,
  18                                 (FloatTensorType, FloatType))
  19     if needs_cast:
  20         output_name = scope.get_unique_variable_name('output')
  21     else:
  22         output_name = operator.outputs[0].full_name
  23 
  24     if index.any():
  25         column_indices_name = scope.get_unique_variable_name('column_indices')
  26 
  27         container.add_initializer(column_indices_name,
  28                                   onnx_proto.TensorProto.INT64,
  29                                   [len(index)], index)
  30 
  31         container.add_node(
  32             'ArrayFeatureExtractor',
  33             [operator.inputs[0].full_name, column_indices_name],
  34             output_name, op_domain='ai.onnx.ml',
  35             name=scope.get_unique_operator_name('ArrayFeatureExtractor'))
  36     else:
  37         container.add_node('ConstantOfShape', operator.inputs[0].full_name,
  38                            output_name, op_version=9)
  39     if needs_cast:
  40         apply_cast(scope, output_name, operator.outputs[0].full_name,
  41                    container, to=onnx_proto.TensorProto.FLOAT)
  42 
  43 
  44 register_converter('SklearnGenericUnivariateSelect',
  45                    convert_sklearn_feature_selection)
  46 register_converter('SklearnRFE', convert_sklearn_feature_selection)
  47 register_converter('SklearnRFECV', convert_sklearn_feature_selection)
  48 register_converter('SklearnSelectFdr', convert_sklearn_feature_selection)
  49 register_converter('SklearnSelectFpr', convert_sklearn_feature_selection)
  50 register_converter('SklearnSelectFromModel', convert_sklearn_feature_selection)
  51 register_converter('SklearnSelectFwe', convert_sklearn_feature_selection)
  52 register_converter('SklearnSelectKBest', convert_sklearn_feature_selection)
  53 register_converter('SklearnSelectPercentile',
  54                    convert_sklearn_feature_selection)
  55 register_converter('SklearnVarianceThreshold',
  56                    convert_sklearn_feature_selection)
  57
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/skl2onnx/operator_converters/feature_selection.py b/skl2onnx/operator_converters/feature_selection.py
  --- a/skl2onnx/operator_converters/feature_selection.py
  +++ b/skl2onnx/operator_converters/feature_selection.py
  @@ -14,6 +14,11 @@
       op = operator.raw_operator
       # Get indices of the features selected
       index = op.get_support(indices=True)
  +    if len(index) == 0:
  +        raise RuntimeError(
  +            "Model '{}' did not select any feature. "
  +            "This model cannot be converted into ONNX."
  +            "".format(op.__class__.__name__))
       needs_cast = not isinstance(operator.inputs[0].type,
                                   (FloatTensorType, FloatType))
       if needs_cast:
  
verification_info: {"golden_diff": "diff --git a/skl2onnx/operator_converters/feature_selection.py b/skl2onnx/operator_converters/feature_selection.py\n--- a/skl2onnx/operator_converters/feature_selection.py\n+++ b/skl2onnx/operator_converters/feature_selection.py\n@@ -14,6 +14,11 @@\n     op = operator.raw_operator\n     # Get indices of the features selected\n     index = op.get_support(indices=True)\n+    if len(index) == 0:\n+        raise RuntimeError(\n+            \"Model '{}' did not select any feature. \"\n+            \"This model cannot be converted into ONNX.\"\n+            \"\".format(op.__class__.__name__))\n     needs_cast = not isinstance(operator.inputs[0].type,\n                                 (FloatTensorType, FloatType))\n     if needs_cast:\n", "issue": "SelectFromModel converted model with threshold such that no features selected give error\nSelectFromModel model in Scikit with threshold such that no features are selected returns an array of shape (M, 0), where M is the number of test instances, onnx converter however can't handle it.\r\n\r\nRuntimeError: [ONNXRuntimeError] : 1 : GENERAL ERROR : Load model from pca1.onnx failed:[ShapeInferenceError] Shape input must be a one-dimensional tensor. \n", "before_files": [{"content": "# -------------------------------------------------------------------------\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See License.txt in the project root for\n# license information.\n# --------------------------------------------------------------------------\n\nfrom ..proto import onnx_proto\nfrom ..common._apply_operation import apply_cast\nfrom ..common._registration import register_converter\nfrom ..common.data_types import FloatTensorType, FloatType\n\n\ndef convert_sklearn_feature_selection(scope, operator, container):\n    op = operator.raw_operator\n    # Get indices of the features selected\n    index = op.get_support(indices=True)\n    needs_cast = not isinstance(operator.inputs[0].type,\n                                (FloatTensorType, FloatType))\n    if needs_cast:\n        output_name = scope.get_unique_variable_name('output')\n    else:\n        output_name = operator.outputs[0].full_name\n\n    if index.any():\n        column_indices_name = scope.get_unique_variable_name('column_indices')\n\n        container.add_initializer(column_indices_name,\n                                  onnx_proto.TensorProto.INT64,\n                                  [len(index)], index)\n\n        container.add_node(\n            'ArrayFeatureExtractor',\n            [operator.inputs[0].full_name, column_indices_name],\n            output_name, op_domain='ai.onnx.ml',\n            name=scope.get_unique_operator_name('ArrayFeatureExtractor'))\n    else:\n        container.add_node('ConstantOfShape', operator.inputs[0].full_name,\n                           output_name, op_version=9)\n    if needs_cast:\n        apply_cast(scope, output_name, operator.outputs[0].full_name,\n                   container, to=onnx_proto.TensorProto.FLOAT)\n\n\nregister_converter('SklearnGenericUnivariateSelect',\n                   convert_sklearn_feature_selection)\nregister_converter('SklearnRFE', convert_sklearn_feature_selection)\nregister_converter('SklearnRFECV', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFdr', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFpr', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFromModel', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFwe', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectKBest', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectPercentile',\n                   convert_sklearn_feature_selection)\nregister_converter('SklearnVarianceThreshold',\n                   convert_sklearn_feature_selection)\n", "path": "skl2onnx/operator_converters/feature_selection.py"}], "after_files": [{"content": "# -------------------------------------------------------------------------\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See License.txt in the project root for\n# license information.\n# --------------------------------------------------------------------------\n\nfrom ..proto import onnx_proto\nfrom ..common._apply_operation import apply_cast\nfrom ..common._registration import register_converter\nfrom ..common.data_types import FloatTensorType, FloatType\n\n\ndef convert_sklearn_feature_selection(scope, operator, container):\n    op = operator.raw_operator\n    # Get indices of the features selected\n    index = op.get_support(indices=True)\n    if len(index) == 0:\n        raise RuntimeError(\n            \"Model '{}' did not select any feature. \"\n            \"This model cannot be converted into ONNX.\"\n            \"\".format(op.__class__.__name__))\n    needs_cast = not isinstance(operator.inputs[0].type,\n                                (FloatTensorType, FloatType))\n    if needs_cast:\n        output_name = scope.get_unique_variable_name('output')\n    else:\n        output_name = operator.outputs[0].full_name\n\n    if index.any():\n        column_indices_name = scope.get_unique_variable_name('column_indices')\n\n        container.add_initializer(column_indices_name,\n                                  onnx_proto.TensorProto.INT64,\n                                  [len(index)], index)\n\n        container.add_node(\n            'ArrayFeatureExtractor',\n            [operator.inputs[0].full_name, column_indices_name],\n            output_name, op_domain='ai.onnx.ml',\n            name=scope.get_unique_operator_name('ArrayFeatureExtractor'))\n    else:\n        container.add_node('ConstantOfShape', operator.inputs[0].full_name,\n                           output_name, op_version=9)\n    if needs_cast:\n        apply_cast(scope, output_name, operator.outputs[0].full_name,\n                   container, to=onnx_proto.TensorProto.FLOAT)\n\n\nregister_converter('SklearnGenericUnivariateSelect',\n                   convert_sklearn_feature_selection)\nregister_converter('SklearnRFE', convert_sklearn_feature_selection)\nregister_converter('SklearnRFECV', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFdr', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFpr', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFromModel', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectFwe', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectKBest', convert_sklearn_feature_selection)\nregister_converter('SklearnSelectPercentile',\n                   convert_sklearn_feature_selection)\nregister_converter('SklearnVarianceThreshold',\n                   convert_sklearn_feature_selection)\n", "path": "skl2onnx/operator_converters/feature_selection.py"}]}