@@ -179,49 +179,29 @@ e.g., cannot access a hardware feature requested
179
179
#### <a name =" tensor " ></a >` type tensor `
180
180
[ ` tensor ` ] ( #tensor )
181
181
<p >
182
- #### <a name =" tensor_data " ></a >` type tensor-data `
183
- [ ` tensor-data ` ] ( #tensor_data )
184
- <p >
185
- #### <a name =" graph_execution_context " ></a >` resource graph-execution-context `
182
+ #### <a name =" named_tensor " ></a >` tuple named-tensor `
183
+ <p >Identify a tensor by name; this is necessary to associate tensors to
184
+ graph inputs and outputs.</p >
185
+ <h5 >Tuple Fields</h5 >
186
+ <ul >
187
+ <li ><a name =" named_tensor.0 " ></a ><code >0</code >: <code >string</code ></li >
188
+ <li ><a name =" named_tensor.1 " ></a ><code >1</code >: own< ; <a href =" #tensor " ><a href =" #tensor " ><code >tensor</code ></a ></a >> ; </li >
189
+ </ul >
190
+ <h4 ><a name =" graph_execution_context " ></a ><code >resource graph-execution-context</code ></h4 >
186
191
<p >Bind a <a href =" #graph " ><code >graph</code ></a > to the input and output tensors for an inference.</p >
187
192
<h2 >TODO: this may no longer be necessary in WIT
188
193
(https://github.com/WebAssembly/wasi-nn/issues/43 )</h2 >
189
194
<h3 >Functions</h3 >
190
- <h4 ><a name =" method_graph_execution_context_set_input " ></a ><code >[method]graph-execution-context.set-input: func</code ></h4 >
191
- <p >Define the inputs to use for inference.</p >
192
- <h5 >Params</h5 >
193
- <ul >
194
- <li ><a name =" method_graph_execution_context_set_input.self " ></a ><code >self</code >: borrow< ; <a href =" #graph_execution_context " ><a href =" #graph_execution_context " ><code >graph-execution-context</code ></a ></a >> ; </li >
195
- <li ><a name =" method_graph_execution_context_set_input.name " ></a ><code >name</code >: <code >string</code ></li >
196
- <li ><a name =" method_graph_execution_context_set_input.tensor " ></a ><a href =" #tensor " ><code >tensor</code ></a >: own< ; <a href =" #tensor " ><a href =" #tensor " ><code >tensor</code ></a ></a >> ; </li >
197
- </ul >
198
- <h5 >Return values</h5 >
199
- <ul >
200
- <li ><a name =" method_graph_execution_context_set_input.0 " ></a > result< ; _, own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
201
- </ul >
202
195
<h4 ><a name =" method_graph_execution_context_compute " ></a ><code >[method]graph-execution-context.compute: func</code ></h4 >
203
196
<p >Compute the inference on the given inputs.</p >
204
- <p >Note the expected sequence of calls: <code >set-input</code >, <code >compute</code >, <code >get-output</code >. TODO: this
205
- expectation could be removed as a part of
206
- https://github.com/WebAssembly/wasi-nn/issues/43 .</p >
207
197
<h5 >Params</h5 >
208
198
<ul >
209
199
<li ><a name =" method_graph_execution_context_compute.self " ></a ><code >self</code >: borrow< ; <a href =" #graph_execution_context " ><a href =" #graph_execution_context " ><code >graph-execution-context</code ></a ></a >> ; </li >
200
+ <li ><a name =" method_graph_execution_context_compute.inputs " ></a ><code >inputs</code >: list< ; <a href =" #named_tensor " ><a href =" #named_tensor " ><code >named-tensor</code ></a ></a >> ; </li >
210
201
</ul >
211
202
<h5 >Return values</h5 >
212
203
<ul >
213
- <li ><a name =" method_graph_execution_context_compute.0 " ></a > result< ; _, own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
214
- </ul >
215
- <h4 ><a name =" method_graph_execution_context_get_output " ></a ><code >[method]graph-execution-context.get-output: func</code ></h4 >
216
- <p >Extract the outputs after inference.</p >
217
- <h5 >Params</h5 >
218
- <ul >
219
- <li ><a name =" method_graph_execution_context_get_output.self " ></a ><code >self</code >: borrow< ; <a href =" #graph_execution_context " ><a href =" #graph_execution_context " ><code >graph-execution-context</code ></a ></a >> ; </li >
220
- <li ><a name =" method_graph_execution_context_get_output.name " ></a ><code >name</code >: <code >string</code ></li >
221
- </ul >
222
- <h5 >Return values</h5 >
223
- <ul >
224
- <li ><a name =" method_graph_execution_context_get_output.0 " ></a > result< ; own< ; <a href =" #tensor " ><a href =" #tensor " ><code >tensor</code ></a ></a >> ; , own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
204
+ <li ><a name =" method_graph_execution_context_compute.0 " ></a > result< ; list< ; <a href =" #named_tensor " ><a href =" #named_tensor " ><code >named-tensor</code ></a ></a >> ; , own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
225
205
</ul >
226
206
<h2 ><a name =" wasi_nn_graph_0_2_0_rc_2024_06_25 " ></a >Import interface wasi:nn/graph@0.2.0-rc-2024-06-25</h2 >
227
207
<p >A <a href =" #graph " ><code >graph</code ></a > is a loaded instance of a specific ML model (e.g., MobileNet) for a specific ML
0 commit comments