public static ExpressionNode transformFeature(ReferenceNode feature, RankProfile profile) {
        String featureName = feature.getName();
        if ( ! featureName.equals("onnxModel") && ! featureName.equals("onnx")) return feature;

        Arguments arguments = feature.getArguments();
        if (arguments.isEmpty())
            throw new IllegalArgumentException("An " + featureName + " feature must take an argument referring to a " +
                                               "onnx-model config or an ONNX file.");
        if (arguments.expressions().size() > 3)
            throw new IllegalArgumentException("An " + featureName + " feature can have at most 3 arguments.");

        // Check that the model configuration "onnx-model" exists. If not defined, it should have been added
        // by the "OnnxModelConfigGenerator" processor. If it still doesn't exist, it is because we can't find
        // the actual ONNX file, which can happen if we are restarting or upgrading an application using an
        // ONNX file that was transformed to Vespa ranking expressions. We then assume it is in the model store.

        String modelConfigName = getModelConfigName(feature.reference());
        OnnxModel onnxModel = profile.onnxModels().get(modelConfigName);
        if (onnxModel == null) {
            String path = asString(arguments.expressions().get(0));
            ModelName modelName = new ModelName(null, Path.fromString(path), true);
            ConvertedModel convertedModel = ConvertedModel.fromStore(profile.schema().applicationPackage(), modelName, path, profile);
            FeatureArguments featureArguments = new FeatureArguments(arguments);
            return convertedModel.expression(featureArguments, null);
        }

        String defaultOutput = onnxModel.getOutputMap().get(onnxModel.getDefaultOutput());
        String output = getModelOutput(feature.reference(), defaultOutput);
        if (! onnxModel.getOutputMap().containsValue(output)) {
            throw new IllegalArgumentException(featureName + " argument '" + output +
                                               "' output not found in model '" + onnxModel.getFileName() + "'");
        }
        return new ReferenceNode("onnx", List.of(new ReferenceNode(modelConfigName)), output);
    }
Transforms ONNX model features of the forms:

    onnx(config_name)
    onnx(config_name).output
    onnx("path/to/model")
    onnx("path/to/model").output
    onnx("path/to/model", "path/to/output")
    onnx("path/to/model", "unused", "path/to/output")    // signature is unused

To the format expected by the backend:

    onnx(config_name).output

@author lesters
config-model/src/main/java/com/yahoo/schema/expressiontransforms/OnnxModelTransformer.java