@@ -165,35 +165,34 @@ class Module {
165
165
const std::string& method_name);
166
166
167
167
/* *
168
- * Execute a specific method with the given input values and retrieve the
169
- * output values. Loads the program and method before executing if needed.
168
+ * Execute a specific method with the given input and retrieve output.
169
+ * Loads the program and method before executing if needed.
170
170
*
171
171
* @param[in] method_name The name of the method to execute.
172
- * @param[in] input_values A vector of input values to be passed to the
173
- * method.
172
+ * @param[in] input A vector of input values to be passed to the method.
174
173
*
175
174
* @returns A Result object containing either a vector of output values
176
175
* from the method or an error to indicate failure.
177
176
*/
178
177
ET_NODISCARD
179
178
runtime::Result<std::vector<runtime::EValue>> execute (
180
179
const std::string& method_name,
181
- const std::vector<runtime::EValue>& input_values );
180
+ const std::vector<runtime::EValue>& input );
182
181
183
182
/* *
184
183
* Execute a specific method with a single input value.
185
184
* Loads the program and method before executing if needed.
186
185
*
187
186
* @param[in] method_name The name of the method to execute.
188
- * @param[in] input_value A value to be passed to the method.
187
+ * @param[in] input A value to be passed to the method.
189
188
*
190
189
* @returns A Result object containing either a vector of output values
191
190
* from the method or an error to indicate failure.
192
191
*/
193
192
ET_NODISCARD inline runtime::Result<std::vector<runtime::EValue>> execute (
194
193
const std::string& method_name,
195
- const runtime::EValue& input_value ) {
196
- return execute (method_name, std::vector<runtime::EValue>{input_value });
194
+ const runtime::EValue& input ) {
195
+ return execute (method_name, std::vector<runtime::EValue>{input });
197
196
}
198
197
199
198
/* *
@@ -211,20 +210,19 @@ class Module {
211
210
}
212
211
213
212
/* *
214
- * Retrieve the output value of a specific method with the given input values .
213
+ * Retrieve the output value of a specific method with the given input.
215
214
* Loads the program and method before execution if needed.
216
215
*
217
216
* @param[in] method_name The name of the method to execute.
218
- * @param[in] input_values A vector of input values to be passed to the
219
- * method.
217
+ * @param[in] input A vector of input values to be passed to the method.
220
218
*
221
219
* @returns A Result object containing either the first output value from the
222
220
* method or an error to indicate failure.
223
221
*/
224
222
ET_NODISCARD inline runtime::Result<runtime::EValue> get (
225
223
const std::string& method_name,
226
- const std::vector<runtime::EValue>& input_values ) {
227
- auto result = ET_UNWRAP (execute (method_name, input_values ));
224
+ const std::vector<runtime::EValue>& input ) {
225
+ auto result = ET_UNWRAP (execute (method_name, input ));
228
226
if (result.empty ()) {
229
227
return runtime::Error::InvalidArgument;
230
228
}
@@ -236,15 +234,15 @@ class Module {
236
234
* Loads the program and method before execution if needed.
237
235
*
238
236
* @param[in] method_name The name of the method to execute.
239
- * @param[in] input_value A value to be passed to the method.
237
+ * @param[in] input A value to be passed to the method.
240
238
*
241
239
* @returns A Result object containing either the first output value from the
242
240
* method or an error to indicate failure.
243
241
*/
244
242
ET_NODISCARD inline runtime::Result<runtime::EValue> get (
245
243
const std::string& method_name,
246
- const runtime::EValue& input_value ) {
247
- return get (method_name, std::vector<runtime::EValue>{input_value });
244
+ const runtime::EValue& input ) {
245
+ return get (method_name, std::vector<runtime::EValue>{input });
248
246
}
249
247
250
248
/* *
@@ -262,31 +260,31 @@ class Module {
262
260
}
263
261
264
262
/* *
265
- * Execute the 'forward' method with the given input values and retrieve the
266
- * output values. Loads the program and method before executing if needed.
263
+ * Execute the 'forward' method with the given input and retrieve output.
264
+ * Loads the program and method before executing if needed.
267
265
*
268
- * @param[in] input_values A vector of input values for the 'forward' method.
266
+ * @param[in] input A vector of input values for the 'forward' method.
269
267
*
270
268
* @returns A Result object containing either a vector of output values
271
269
* from the 'forward' method or an error to indicate failure.
272
270
*/
273
271
ET_NODISCARD inline runtime::Result<std::vector<runtime::EValue>> forward (
274
- const std::vector<runtime::EValue>& input_values ) {
275
- return execute (" forward" , input_values );
272
+ const std::vector<runtime::EValue>& input ) {
273
+ return execute (" forward" , input );
276
274
}
277
275
278
276
/* *
279
277
* Execute the 'forward' method with a single value.
280
278
* Loads the program and method before executing if needed.
281
279
*
282
- * @param[in] input_value A value for the 'forward' method.
280
+ * @param[in] input A value for the 'forward' method.
283
281
*
284
282
* @returns A Result object containing either a vector of output values
285
283
* from the 'forward' method or an error to indicate failure.
286
284
*/
287
285
ET_NODISCARD inline runtime::Result<std::vector<runtime::EValue>> forward (
288
- const runtime::EValue& input_value ) {
289
- return forward (std::vector<runtime::EValue>{input_value });
286
+ const runtime::EValue& input ) {
287
+ return forward (std::vector<runtime::EValue>{input });
290
288
}
291
289
292
290
/* *
@@ -300,42 +298,6 @@ class Module {
300
298
return forward (std::vector<runtime::EValue>{});
301
299
}
302
300
303
- /* *
304
- * Sets the output tensor for a specific method.
305
- *
306
- * @param[in] method_name The name of the method.
307
- * @param[in] output_value The EValue containing the Tensor to set as the
308
- * method output.
309
- * @param[in] output_index Zero-based index of the output to set.
310
- *
311
- * @returns An Error to indicate success or failure.
312
- *
313
- * @note Only Tensor outputs are currently supported for setting.
314
- */
315
- ET_NODISCARD
316
- runtime::Error set_output (
317
- const std::string& method_name,
318
- runtime::EValue output_value,
319
- size_t output_index = 0 );
320
-
321
- /* *
322
- * Sets the output tensor for the "forward" method.
323
- *
324
- * @param[in] output_value The EValue containing the Tensor to set as the
325
- * method output.
326
- * @param[in] output_index Zero-based index of the output to set.
327
- *
328
- * @returns An Error to indicate success or failure.
329
- *
330
- * @note Only Tensor outputs are currently supported for setting.
331
- */
332
- ET_NODISCARD
333
- inline runtime::Error set_output (
334
- runtime::EValue output_value,
335
- size_t output_index = 0 ) {
336
- return set_output (" forward" , output_value, output_index);
337
- }
338
-
339
301
/* *
340
302
* Retrieves the EventTracer instance being used by the Module.
341
303
* EventTracer is used for tracking and logging events during the execution
@@ -348,6 +310,19 @@ class Module {
348
310
return event_tracer_.get ();
349
311
}
350
312
313
+ /* *
314
+ * Set output data pointer for forward method.
315
+ *
316
+ * @param[in] output_value A Tensor for the output of 'forward' method.
317
+ * @param[in] output_index Index of the output in 'forward' method.
318
+ *
319
+ * @returns An Error to indicate success or failure of the loading process.
320
+ */
321
+ runtime::Error set_output_data_ptr (
322
+ runtime::EValue output_value,
323
+ size_t output_index,
324
+ const std::string& method_name = " forward" );
325
+
351
326
private:
352
327
struct MethodHolder {
353
328
std::vector<std::vector<uint8_t >> planned_buffers;
0 commit comments