diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a039b4b..90dce34 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -11,6 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - uses: WebAssembly/wit-abi-up-to-date@v3
+ - uses: WebAssembly/wit-abi-up-to-date@v4
with:
- wit-abi-tag: wit-abi-0.1.0
+ wit-abi-tag: wit-abi-0.2.0
diff --git a/wasi-nn.abi.md b/wasi-nn.abi.md
index 1dd8f3f..ab45557 100644
--- a/wasi-nn.abi.md
+++ b/wasi-nn.abi.md
@@ -2,20 +2,15 @@
## `tensor-dimensions`: list<`u32`>
- The dimensions of a tensor.
-
- The array length matches the tensor rank and each element in the array
- describes the size of each dimension.
Size: 8, Alignment: 4
-## `tensor-type`: variant
+## `tensor-type`: enum
- The type of the elements in a tensor.
Size: 1, Alignment: 1
-### Variant Cases
+### Enum Cases
- [`fp16`](#tensor_type.fp16)
@@ -31,19 +26,11 @@ Size: 1, Alignment: 1
## `tensor-data`: list<`u8`>
- The tensor data.
-
- Initially coneived as a sparse representation, each empty cell would be filled with zeros and
- the array length must match the product of all of the dimensions and the number of bytes in the
- type (e.g., a 2x2 tensor with 4-byte f32 elements would have a data array of length 16).
- Naturally, this representation requires some knowledge of how to lay out data in memory--e.g.,
- using row-major ordering--and could perhaps be improved.
Size: 8, Alignment: 4
## `tensor`: record
- A tensor.
Size: 20, Alignment: 4
@@ -51,23 +38,15 @@ Size: 20, Alignment: 4
- [`dimensions`](#tensor.dimensions): [`tensor-dimensions`](#tensor_dimensions)
- Describe the size of the tensor (e.g., 2x2x2x2 -> [2, 2, 2, 2]). To represent a tensor
- containing a single value, use `[1]` for the tensor dimensions.
- [`tensor-type`](#tensor.tensor_type): [`tensor-type`](#tensor_type)
- Describe the type of element in the tensor (e.g., f32).
- [`data`](#tensor.data): [`tensor-data`](#tensor_data)
- Contains the tensor data.
## `graph-builder`: list<`u8`>
- The graph initialization data.
-
- This consists of an array of buffers because implementing backends may encode their graph IR in
- parts (e.g., OpenVINO stores its IR and weights separately).
Size: 8, Alignment: 4
@@ -76,14 +55,12 @@ Size: 8, Alignment: 4
Size: 8, Alignment: 4
-## `graph-encoding`: variant
+## `graph-encoding`: enum
- Describes the encoding of the graph. This allows the API to be implemented by various backends
- that encode (i.e., serialize) their graph IR with different formats.
Size: 1, Alignment: 1
-### Variant Cases
+### Enum Cases
- [`openvino`](#graph_encoding.openvino)
@@ -94,13 +71,12 @@ Size: 1, Alignment: 1
- [`tensorflow`](#graph_encoding.tensorflow)
-## `execution-target`: variant
+## `execution-target`: enum
- Define where the graph should be executed.
Size: 1, Alignment: 1
-### Variant Cases
+### Enum Cases
- [`cpu`](#execution_target.cpu)
@@ -111,37 +87,30 @@ Size: 1, Alignment: 1
- [`tpu`](#execution_target.tpu)
-## `error`: variant
+## `error`: enum
- Error codes returned by functions in this API.
Size: 1, Alignment: 1
-### Variant Cases
+### Enum Cases
- [`success`](#error.success)
- No error occurred.
- [`invalid-argument`](#error.invalid_argument)
- Caller module passed an invalid argument.
- [`invalid-encoding`](#error.invalid_encoding)
- Invalid encocing.
- [`missing-memory`](#error.missing_memory)
- Caller module is missing a memory export.
- [`busy`](#error.busy)
- Device or resource busy.
- [`runtime-error`](#error.runtime_error)
- Runtime Error.
# Functions
@@ -149,64 +118,59 @@ Size: 1, Alignment: 1
#### `load`
- Load an opaque sequence of bytes to use for inference.
##### Params
- `builder`: [`graph-builder-array`](#graph_builder_array)
- `encoding`: [`graph-encoding`](#graph_encoding)
- `target`: [`execution-target`](#execution_target)
-##### Results
+##### Result
-- ``: expected, [`error`](#error)>
+- expected, [`error`](#error)>
----
#### `init-execution-context`
- Create an execution instance of a loaded graph.
##### Params
- `graph`: handle
-##### Results
+##### Result
-- ``: expected, [`error`](#error)>
+- expected, [`error`](#error)>
----
#### `set-input`
- Define the inputs to use for inference.
##### Params
- `ctx`: handle
- `index`: `u32`
- `tensor`: [`tensor`](#tensor)
-##### Results
+##### Result
-- ``: expected<_, [`error`](#error)>
+- expected<`unit`, [`error`](#error)>
----
#### `compute`
- Compute the inference on the given inputs.
##### Params
- `ctx`: handle
-##### Results
+##### Result
-- ``: expected<_, [`error`](#error)>
+- expected<`unit`, [`error`](#error)>
----
#### `get-output`
- Extract the outputs after inference.
##### Params
- `ctx`: handle
- `index`: `u32`
-##### Results
+##### Result
-- ``: expected<[`tensor`](#tensor), [`error`](#error)>
+- expected<[`tensor`](#tensor), [`error`](#error)>
diff --git a/wasi-nn.wit.md b/wasi-nn.wit.md
index 56bceb6..a675026 100644
--- a/wasi-nn.wit.md
+++ b/wasi-nn.wit.md
@@ -107,10 +107,10 @@ index:
```wit
// Define the inputs to use for inference.
-set-input: function(ctx: graph-execution-context, index: u32, tensor: tensor) -> expected<_, error>
+set-input: function(ctx: graph-execution-context, index: u32, tensor: tensor) -> expected
// Compute the inference on the given inputs.
-compute: function(ctx: graph-execution-context) -> expected<_, error>
+compute: function(ctx: graph-execution-context) -> expected
// Extract the outputs after inference.
get-output: function(ctx: graph-execution-context, index: u32) -> expected