Support ResizeBilinear operation on onert, under cpu backend, and for float32 as well as quant8 asymm data types (See parent issue #1715).
While implementing the cker for ResizeBilinear, I noticed that the IR misses two bool fields, namely align_corners and half_pixel_centers, and also a size tensor. I added them to operation::ResizeBilinear::Param (please refer #3489). However, when I test for the operation, I get the following error message:
[ RUN ] GeneratedTests.resize_bilinear_2
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:146: Failure
Expected: Result::NO_ERROR
Which is: 4-byte object <00-00 00-00>
To be equal to: execution.setInput(idx, buffer, s)
Which is: 4-byte object <03-00 00-00>
Google Test trace:
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:123: 0
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:235: TestCompilationCaching = 0
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:153: Failure
Expected: Result::NO_ERROR
Which is: 4-byte object <00-00 00-00>
To be equal to: execution.setOutput(idx, buffer, s)
Which is: 4-byte object <03-00 00-00>
Google Test trace:
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:123: 0
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:235: TestCompilationCaching = 0
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:158: Failure
Expected: Result::NO_ERROR
Which is: 4-byte object <00-00 00-00>
To be equal to: r
Which is: 4-byte object <03-00 00-00>
Google Test trace:
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:123: 0
/home/***/ONE/tests/nnapi/src/TestGenerated.cpp:235: TestCompilationCaching = 0
[ FAILED ] GeneratedTests.resize_bilinear_2 (3 ms)
I also noticed that under OperationFactory, init_params.input_count is set to 3, which means I have not accounted for the newly added bool fields and the size tensor. Is this outside the scope of onert backend, or alternatively, is there a way I could access the bool fields as well the size tensor? Please let me know. Thanks in advance.
NNAPI ResizeBilinear spec
size tensor, instead it uses output_width and output_height input scalaralign_cornershalf_pixel_centers: it is introduced after 2.2.0To pass nnapi generated test,
size tensorTRANSPOSE operation's perm input tensorReshape IR and cpu KernelGenerator: optional inputalign_corners and half_pixel_centers to internal IR parameter but set false on NNAPI frontend@hseok-oh , thanks for your reply.
If I understand correctly, I should do the following:
align_corners and half_pixel_centers to false in the IR (in OperationFactory.cc as well as base_loader.h)out_height and out_widthPoint 2 above means that size will have to be a constant. In fact, base_loader.h has that check in place. I hope that is not a limitation.
- set
align_cornersandhalf_pixel_centersto false in the IR (inOperationFactory.ccas well asbase_loader.h)
base_loader.h may set align_corners and half_pixel_centers by using tflite model file because tflite model file may have those values.
- Pass size as a parameter when writing the testcases, but convert their contents into IR parameters: namely
out_heightandout_width
NNAPI's scalar tensor is always constant, so there may no problem to pass nnapi generation test. For tflite frontend and KernelGenerator, please check Reshape implementation.
I modified the IR as suggested above, and updated the pull request. I now get verification test failure for the resizebilinear operation as shown below:
14:48:19 ok 50 - reshape/reshape2
14:48:19 not ok 51 - resize_bilinear
14:48:19 ok 52 - rsqrt
From the logs, the nnapi_gtest testcases for ResizeBilinear seem to pass. May I have some details on how to troubleshoot verification test failures in general?
I modified the IR as suggested above, and updated the pull request. I now get verification test failure for the resizebilinear operation as shown below:
14:48:19 ok 50 - reshape/reshape2 14:48:19 not ok 51 - resize_bilinear 14:48:19 ok 52 - rsqrtFrom the logs, the
nnapi_gtesttestcases for ResizeBilinear seem to pass. May I have some details on how to troubleshoot verification test failures in general?
Resolved as per recommendations from @hseok-oh in #3489, thank you for your inputs.