@@ -32,8 +32,6 @@ typedef struct {
32
32
void * weight_data ;
33
33
ov_tensor_t * weights_tensor ;
34
34
ov_model_t * model ;
35
- /* add prepostprocess */
36
- ov_model_t * new_model ;
37
35
ov_compiled_model_t * compiled_model ;
38
36
ov_infer_request_t * infer_request ;
39
37
ov_tensor_t * input_tensor ;
@@ -284,16 +282,6 @@ set_input(void *ctx, graph_execution_context exec_ctx, uint32_t index,
284
282
ov_shape_t input_shape = { 0 };
285
283
int64_t * ov_dims = NULL ;
286
284
287
- ov_preprocess_prepostprocessor_t * ppp = NULL ;
288
- ov_preprocess_input_info_t * input_info = NULL ;
289
- ov_preprocess_input_tensor_info_t * input_tensor_info = NULL ;
290
- ov_layout_t * input_layout = NULL ;
291
- ov_preprocess_preprocess_steps_t * input_process = NULL ;
292
- ov_preprocess_input_model_info_t * p_input_model = NULL ;
293
- ov_layout_t * model_layout = NULL ;
294
- ov_preprocess_output_info_t * output_info = NULL ;
295
- ov_preprocess_output_tensor_info_t * output_tensor_info = NULL ;
296
-
297
285
/* wasi_nn_tensor -> ov_tensor */
298
286
{
299
287
ret = uint32_array_to_int64_array (wasi_nn_tensor -> dimensions -> size ,
@@ -322,57 +310,8 @@ set_input(void *ctx, graph_execution_context exec_ctx, uint32_t index,
322
310
ret );
323
311
}
324
312
325
- /* set preprocess based on wasi_nn_tensor */
326
- {
327
- CHECK_OV_STATUS (
328
- ov_preprocess_prepostprocessor_create (ov_ctx -> model , & ppp ), ret );
329
-
330
- /* reuse user' created tensor's info */
331
- CHECK_OV_STATUS (ov_preprocess_prepostprocessor_get_input_info_by_index (
332
- ppp , index , & input_info ),
333
- ret );
334
- CHECK_OV_STATUS (ov_preprocess_input_info_get_tensor_info (
335
- input_info , & input_tensor_info ),
336
- ret );
337
- CHECK_OV_STATUS (ov_preprocess_input_tensor_info_set_from (
338
- input_tensor_info , ov_ctx -> input_tensor ),
339
- ret );
340
-
341
- /* add RESIZE */
342
- CHECK_OV_STATUS (ov_preprocess_input_info_get_preprocess_steps (
343
- input_info , & input_process ),
344
- ret );
345
- CHECK_OV_STATUS (
346
- ov_preprocess_preprocess_steps_resize (input_process , RESIZE_LINEAR ),
347
- ret );
348
-
349
- /* input model */
350
- CHECK_OV_STATUS (
351
- ov_preprocess_input_info_get_model_info (input_info , & p_input_model ),
352
- ret );
353
- // TODO: what if not?
354
- CHECK_OV_STATUS (ov_layout_create ("NCHW" , & model_layout ), ret );
355
- CHECK_OV_STATUS (ov_preprocess_input_model_info_set_layout (p_input_model ,
356
- model_layout ),
357
- ret );
358
-
359
- /* output -> F32(possibility) */
360
- CHECK_OV_STATUS (ov_preprocess_prepostprocessor_get_output_info_by_index (
361
- ppp , index , & output_info ),
362
- ret );
363
- CHECK_OV_STATUS (ov_preprocess_output_info_get_tensor_info (
364
- output_info , & output_tensor_info ),
365
- ret );
366
- CHECK_OV_STATUS (
367
- ov_preprocess_output_set_element_type (output_tensor_info , F32 ),
368
- ret );
369
-
370
- CHECK_OV_STATUS (
371
- ov_preprocess_prepostprocessor_build (ppp , & ov_ctx -> new_model ), ret );
372
- }
373
-
374
- CHECK_OV_STATUS (ov_core_compile_model (ov_ctx -> core , ov_ctx -> new_model ,
375
- "CPU" , 0 , & ov_ctx -> compiled_model ),
313
+ CHECK_OV_STATUS (ov_core_compile_model (ov_ctx -> core , ov_ctx -> model , "CPU" , 0 ,
314
+ & ov_ctx -> compiled_model ),
376
315
ret );
377
316
378
317
CHECK_OV_STATUS (ov_compiled_model_create_infer_request (
@@ -389,24 +328,6 @@ set_input(void *ctx, graph_execution_context exec_ctx, uint32_t index,
389
328
if (ov_dims )
390
329
os_free (ov_dims );
391
330
ov_shape_free (& input_shape );
392
- if (ppp )
393
- ov_preprocess_prepostprocessor_free (ppp );
394
- if (input_info )
395
- ov_preprocess_input_info_free (input_info );
396
- if (input_tensor_info )
397
- ov_preprocess_input_tensor_info_free (input_tensor_info );
398
- if (input_layout )
399
- ov_layout_free (input_layout );
400
- if (input_process )
401
- ov_preprocess_preprocess_steps_free (input_process );
402
- if (p_input_model )
403
- ov_preprocess_input_model_info_free (p_input_model );
404
- if (model_layout )
405
- ov_layout_free (model_layout );
406
- if (output_info )
407
- ov_preprocess_output_info_free (output_info );
408
- if (output_tensor_info )
409
- ov_preprocess_output_tensor_info_free (output_tensor_info );
410
331
411
332
return ret ;
412
333
}
0 commit comments