private void assertModelEvaluation(VespaModel model, Path appDir, boolean shouldRequireGpu) {
        ApplicationContainerCluster cluster = model.getContainerClusters().get("container");
        assertNotNull(cluster.getComponentsMap().get(new ComponentId(ModelsEvaluator.class.getName())));

        RankProfilesConfig.Builder b = new RankProfilesConfig.Builder();
        cluster.getConfig(b);
        RankProfilesConfig config = new RankProfilesConfig(b);

        RankingConstantsConfig.Builder cb = new RankingConstantsConfig.Builder();
        cluster.getConfig(cb);
        RankingConstantsConfig constantsConfig = new RankingConstantsConfig(cb);

        RankingExpressionsConfig.Builder ce = new RankingExpressionsConfig.Builder();
        cluster.getConfig(ce);
        RankingExpressionsConfig expressionsConfig = ce.build();

        OnnxModelsConfig.Builder ob = new OnnxModelsConfig.Builder();
        cluster.getConfig(ob);
        OnnxModelsConfig onnxModelsConfig = new OnnxModelsConfig(ob);

        assertEquals(1, config.rankprofile().size());
        Set<String> modelNames = config.rankprofile().stream().map(v -> v.name()).collect(Collectors.toSet());
        assertTrue(modelNames.contains("mul"));

        OnnxModelsConfig.Model mulModel = onnxModelsConfig.model().get(0);
        assertEquals(2, mulModel.stateless_intraop_threads());
        assertEquals(-1, mulModel.stateless_interop_threads());
        assertEquals("", mulModel.stateless_execution_mode());
        assertEquals(shouldRequireGpu, mulModel.gpu_device_required());
        assertEquals(0, mulModel.gpu_device());

        // This is actually how ModelsEvaluator is injected
        Map<String, File> fileMap = new HashMap<>();
        for (OnnxModelsConfig.Model onnxModel : onnxModelsConfig.model()) {
            fileMap.put(onnxModel.fileref().value(), appDir.append(onnxModel.fileref().value()).toFile());
        }
        FileAcquirer fileAcquirer = MockFileAcquirer.returnFiles(fileMap);
        try {
            ModelsEvaluator modelsEvaluator = new ModelsEvaluator(config, constantsConfig, expressionsConfig, onnxModelsConfig, fileAcquirer);
            assertEquals(1, modelsEvaluator.models().size());

            Model mul = modelsEvaluator.models().get("mul");
            FunctionEvaluator evaluator = mul.evaluatorOf();  // or "default.output" - or actually use name of model output

            Tensor input1 = Tensor.from("tensor<float>(d0[1]):[2]");
            Tensor input2 = Tensor.from("tensor<float>(d0[1]):[3]");
            Tensor output = evaluator.bind("input1", input1).bind("input2", input2).evaluate();
            assertEquals(6.0, output.sum().asDouble(), 1e-9);
        } catch (IllegalArgumentException e) {
            boolean gotWantedException = false;
            for (Throwable cause = e; shouldRequireGpu && cause != null; cause = cause.getCause()) {
                if (cause.getMessage().equals("GPU device is required, but CUDA initialization failed")) {
                    gotWantedException = true;
                    break;
                }
            }
            if (!gotWantedException) {
                throw e;
            }
        }
    }
Tests stateless model evaluation (turned on by the "model-evaluation" tag in "container")
for ONNX models.

@author lesters
config-model/src/test/java/com/yahoo/vespa/model/ml/StatelessOnnxEvaluationTest.java