code: def _encoder_handle_unknown_transformer_converter(
      scope, operator, container, name_prefix
  ):
      from skl2onnx.algebra.onnx_ops import (
          OnnxAbs,
          OnnxArgMin,
          OnnxCast,
          OnnxConcat,
          OnnxMatMul,
          OnnxOneHot,
          OnnxReshape,
          OnnxSplit,
          OnnxSub,
      )
      from skl2onnx.common.data_types import guess_numpy_type
  
      op = operator.raw_operator
      opv = container.target_opset
      out = operator.outputs
  
      # We retrieve the unique input.
      X = operator.inputs[0]
  
      # In most case, computation happen in floats.
      # But it might be with double. ONNX is very strict
      # about types, every constant should have the same
      # type as the input.
      dtype = guess_numpy_type(X.type)
      batch_size = X.type.shape[0]
      num_categories = len(op.categories_)
  
      C_col = op.categories_
      if opv < 18:
          X_col = OnnxSplit(
              X,
              axis=1,
              output_names=[
                  f"{name_prefix}X_col{x}"
                  for x in range(num_categories)
              ],
              op_version=opv,
          )
      else:
          X_col = OnnxSplit(
              X,
              axis=1,
              num_outputs=X.type.shape[1],
              output_names=[
                  f"{name_prefix}X_col{x}"
                  for x in range(num_categories)
              ],
              op_version=opv,
          )
      X_col.add_to(scope, container)
      Y_col = []
      for feature_idx in range(num_categories):
          # This implements
          # > X_col = np.searchsorted(X_col_finite, self.references_)
          #
          # Specifically, for yi = np.searchsorted(xi, x), we implement
          # > def searchsorted(xi, x, y):
          # >     idx = np.abs(x - xi[:,None])
          # >     return idx.argmin(axis=1)
          num_classes = len(C_col[feature_idx])
          repeat = OnnxMatMul(
              OnnxReshape(
                  X_col.outputs[feature_idx],
                  np.array([batch_size, 1], dtype=np.int64),
                  op_version=opv,
              ),
              np.ones(shape=(1, num_classes)).astype(dtype),
              op_version=opv,
          )
          sub = OnnxSub(
              repeat,
              OnnxReshape(
                  C_col[feature_idx].astype(dtype),
                  np.array([1, num_classes], dtype=np.int64),
                  op_version=opv,
              ),
              op_version=opv,
              output_names=[f"{name_prefix}sub_col{feature_idx}"],
          )
          idx = OnnxAbs(
              sub,
              op_version=opv,
              output_names=[f"{name_prefix}idx_col{feature_idx}"],
          )
          argmin = OnnxArgMin(
              OnnxReshape(
                  idx,
                  np.array([batch_size, num_classes], dtype=np.int64),
                  op_version=opv,
              ),
              axis=1,
              op_version=opv,
              output_names=[f"{name_prefix}argmin_col{feature_idx}"],
          )
          if name_prefix.startswith("onehot"):
              onehot = OnnxOneHot(
                  argmin,
                  np.array([num_classes]).astype(
                      np.int64
                  ),  # number of classes
                  np.array([0, 1]).astype(
                      dtype
                  ),  # [off_value, on_value]
                  axis=1,
                  op_version=opv,
                  output_names=[
                      f"{name_prefix}onehot_col{feature_idx}"
                  ],
              )
              onehot_reshaped = OnnxReshape(
                  onehot,
                  np.array([batch_size, num_classes], dtype=np.int64),
                  output_names=[f"{name_prefix}Y_col{feature_idx}"],
                  op_version=opv,
              )
              onehot_cast = OnnxCast(
                  onehot_reshaped,
                  to=1,
                  op_version=opv,
                  output_names=[
                      f"{name_prefix}onehot_cast{feature_idx}"
                  ],
              )
              Y_col.append(onehot_cast)
          else:
              argmin_reshaped = OnnxReshape(
                  argmin,
                  np.array([batch_size, 1], dtype=np.int64),
                  output_names=[f"{name_prefix}Y_col{feature_idx}"],
                  op_version=opv,
              )
              argmin_cast = OnnxCast(
                  argmin_reshaped,
                  to=1,
                  op_version=opv,
                  output_names=[
                      f"{name_prefix}argmin_cast{feature_idx}"
                  ],
              )
              Y_col.append(argmin_cast)
      Y = OnnxConcat(
          *Y_col, axis=1, op_version=opv, output_names=out[:1]
      )
      Y.add_to(scope, container)
  
imports: import os
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: _encoder_handle_unknown_transformer_converter(scope, operator, container, name_prefix) without return types