@@ -169,49 +169,29 @@ e.g., cannot access a hardware feature requested
169
169
#### <a name =" tensor " ></a >` type tensor `
170
170
[ ` tensor ` ] ( #tensor )
171
171
<p >
172
- #### <a name =" tensor_data " ></a >` type tensor-data `
173
- [ ` tensor-data ` ] ( #tensor_data )
174
- <p >
175
- #### <a name =" graph_execution_context " ></a >` resource graph-execution-context `
172
+ #### <a name =" named_tensor " ></a >` tuple named-tensor `
173
+ <p >Identify a tensor by name; this is necessary to associate tensors to
174
+ graph inputs and outputs.</p >
175
+ <h5 >Tuple Fields</h5 >
176
+ <ul >
177
+ <li ><a name =" named_tensor.0 " ></a ><code >0</code >: <code >string</code ></li >
178
+ <li ><a name =" named_tensor.1 " ></a ><code >1</code >: own< ; <a href =" #tensor " ><a href =" #tensor " ><code >tensor</code ></a ></a >> ; </li >
179
+ </ul >
180
+ <h4 ><a name =" graph_execution_context " ></a ><code >resource graph-execution-context</code ></h4 >
176
181
<p >Bind a <a href =" #graph " ><code >graph</code ></a > to the input and output tensors for an inference.</p >
177
182
<h2 >TODO: this may no longer be necessary in WIT
178
183
(https://github.com/WebAssembly/wasi-nn/issues/43 )</h2 >
179
184
<h3 >Functions</h3 >
180
- <h4 ><a name =" method_graph_execution_context_set_input " ></a ><code >[method]graph-execution-context.set-input: func</code ></h4 >
181
- <p >Define the inputs to use for inference.</p >
182
- <h5 >Params</h5 >
183
- <ul >
184
- <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 >
185
- <li ><a name =" method_graph_execution_context_set_input.name " ></a ><code >name</code >: <code >string</code ></li >
186
- <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 >
187
- </ul >
188
- <h5 >Return values</h5 >
189
- <ul >
190
- <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 >
191
- </ul >
192
185
<h4 ><a name =" method_graph_execution_context_compute " ></a ><code >[method]graph-execution-context.compute: func</code ></h4 >
193
186
<p >Compute the inference on the given inputs.</p >
194
- <p >Note the expected sequence of calls: <code >set-input</code >, <code >compute</code >, <code >get-output</code >. TODO: this
195
- expectation could be removed as a part of
196
- https://github.com/WebAssembly/wasi-nn/issues/43 .</p >
197
187
<h5 >Params</h5 >
198
188
<ul >
199
189
<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 >
190
+ <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 >
200
191
</ul >
201
192
<h5 >Return values</h5 >
202
193
<ul >
203
- <li ><a name =" method_graph_execution_context_compute.0 " ></a > result< ; _, own< ; <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ;> ; </li >
204
- </ul >
205
- <h4 ><a name =" method_graph_execution_context_get_output " ></a ><code >[method]graph-execution-context.get-output: func</code ></h4 >
206
- <p >Extract the outputs after inference.</p >
207
- <h5 >Params</h5 >
208
- <ul >
209
- <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 >
210
- <li ><a name =" method_graph_execution_context_get_output.name " ></a ><code >name</code >: <code >string</code ></li >
211
- </ul >
212
- <h5 >Return values</h5 >
213
- <ul >
214
- <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 >
194
+ <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 >
215
195
</ul >
216
196
<h2 ><a name =" wasi_nn_graph_0_2_0_rc_2024_08_19 " ></a >Import interface wasi:nn/graph@0.2.0-rc-2024-08-19</h2 >
217
197
<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