private ExpressionFunction optimize(ExpressionFunction function, ContextIndex context) {
        // Note: Optimization is in-place but we do not depend on that outside this method
        expressionOptimizer.optimize(function.getBody(), context);
        return function;
    }
Returns an optimized version of the given function
model-evaluation/src/main/java/ai/vespa/models/evaluation/Model.java