Package com.yahoo.vespa.model.ml
Class OnnxModelInfo
java.lang.Object
com.yahoo.vespa.model.ml.OnnxModelInfo
Model information (input and output types) for an ONNX model.
This encapsulates the difference between reading ONNX model information
- from a file application package, where we can read the ONNX model directly
- from a ZK application package, where the file is unavailable and models are read from
generated files stored in file distribution or ZooKeeper.
- Author:
- lesters
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
asValidIdentifier
(String str) com.yahoo.tensor.TensorType
getTensorType
(String onnxName, Map<String, com.yahoo.tensor.TensorType> inputTypes) Return the tensor type for an ONNX model for the given context.static OnnxModelInfo
jsonToModelInfo
(String json, com.yahoo.config.application.api.ApplicationPackage app) static OnnxModelInfo
static boolean
modelExists
(String path, com.yahoo.config.application.api.ApplicationPackage app)
-
Method Details
-
getModelPath
-
getInputs
-
getOutputs
-
getInitializers
-
getDefaultOutput
-
getTensorType
public com.yahoo.tensor.TensorType getTensorType(String onnxName, Map<String, com.yahoo.tensor.TensorType> inputTypes) Return the tensor type for an ONNX model for the given context. An ONNX model can have dynamic/symbolic dimension sizes. If so, the output type depends on the input types for the given context (rank profile). -
load
public static OnnxModelInfo load(String path, com.yahoo.config.application.api.ApplicationPackage app) -
modelExists
public static boolean modelExists(String path, com.yahoo.config.application.api.ApplicationPackage app) -
jsonToModelInfo
public static OnnxModelInfo jsonToModelInfo(String json, com.yahoo.config.application.api.ApplicationPackage app) throws IOException - Throws:
IOException
-
asValidIdentifier
-