diff --git a/ml.md b/ml.md index bce656f..5965a64 100644 --- a/ml.md +++ b/ml.md @@ -276,6 +276,44 @@ graph IR in parts (e.g., OpenVINO stores its IR and weights separately).

+

[method]graph.list-properties: func

+

Retrieve the properties of the graph.

+

These are metadata about the graph, unique to the graph and the +ML backend providing it.

+
Params
+ +
Return values
+ +

[method]graph.get-property: func

+

Retrieve the value of a property.

+

If the property does not exist, this function returns none.

+
Params
+ +
Return values
+ +

[method]graph.set-property: func

+

Modify the value of a property.

+

If the operation fails, this function returns a string from the ML +backend describing the error.

+
Params
+ +
Return values
+

load: func

Load a graph from an opaque sequence of bytes to use for inference.

Params
diff --git a/wit/wasi-nn.wit b/wit/wasi-nn.wit index 872e8cd..3fd0b13 100644 --- a/wit/wasi-nn.wit +++ b/wit/wasi-nn.wit @@ -68,6 +68,23 @@ interface graph { /// An execution graph for performing inference (i.e., a model). resource graph { init-execution-context: func() -> result; + + /// Retrieve the properties of the graph. + /// + /// These are metadata about the graph, unique to the graph and the + /// ML backend providing it. + list-properties: func() -> list; + + /// Retrieve the value of a property. + /// + /// If the property does not exist, this function returns `none`. + get-property: func(name: string) -> option; + + /// Modify the value of a property. + /// + /// If the operation fails, this function returns a string from the ML + /// backend describing the error. + set-property: func(name: string, value: string) -> result<_, string>; } /// Describes the encoding of the graph. This allows the API to be implemented by various