aboutsummaryrefslogtreecommitdiffstats
path: root/config-model-api/src/main/java/com/yahoo/config/model/api/OnnxModelCost.java
blob: 595cd97e6b6e19be98e6cd18445e125d637ccec9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.config.model.api;

import com.yahoo.config.ModelReference;
import com.yahoo.config.application.api.ApplicationFile;
import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.config.application.api.DeployLogger;

/**
 * @author bjorncs
 */
public interface OnnxModelCost {

    Calculator newCalculator(ApplicationPackage appPkg, DeployLogger logger);

    interface Calculator {
        long aggregatedModelCostInBytes();
        void registerModel(ApplicationFile path);
        void registerModel(ModelReference ref);
    }

    static OnnxModelCost disabled() {
        return (__, ___) -> new Calculator() {
            @Override public long aggregatedModelCostInBytes() { return 0; }
            @Override public void registerModel(ApplicationFile path) {}
            @Override public void registerModel(ModelReference ref) {}
        };
    }
}