[microNPU] Update Conv2D Tests to Use TF API to Gen Test Cases#9508
Conversation
manupak
left a comment
There was a problem hiding this comment.
Thanks for the cleaning this up @dchauhan-arm ! Much appreciated :).
Broadly looks good and few suggestions to improve it a bit.
ekalda
left a comment
There was a problem hiding this comment.
Thanks for cleaning this up, good first patch :) While you are at it, can you also remove relay_ir_builder.py file since after this change we don't use relay_ir_builder any more?
|
@dchauhan-arm Shall we try to get this merged? |
There was a problem hiding this comment.
Thanks @dchauhan-arm it looks like this PR is almost ready :) Could you fix the formatting issues and a couple of very minor things?
It looks like linting is failing on running black, you can use ./docker/bash.sh tvm.ci_lint ./tests/lint/git-black.sh -i HEAD~1 locally to fix this
ekalda
left a comment
There was a problem hiding this comment.
Mostly looks good (modulo Luke's comments and linting fixes)! :)
| op = tf.nn.conv2d( | ||
| x, | ||
| filters=tf.constant(np.random.uniform( | ||
| size=(kernel_shape[0], kernel_shape[1], 3, 3)), dtype=tf.float32), | ||
| strides=strides | ||
| padding=padding, | ||
| data_format="NHWC", | ||
| dilations=dilation, | ||
| ) |
There was a problem hiding this comment.
This currently tests a special case of input channels and output channels being equal, I think it would be better to test a more general case for the conv2d (e.g. if the legalization pass got ifm and ofm channels mixed up, we would never find out), but I wonder what @manupa-arm thinks about whether it's worth changing?
There was a problem hiding this comment.
Its a good point -- lets follow up with another PR to improve coverage.
Update ordering of imports
Remove unused import
Address comments, use infra.py function to compute ofm_shape
Missing square brackets in parametrization, missing underscores.
b86add3 to
40da2da
Compare
ekalda
left a comment
There was a problem hiding this comment.
LGTM, let's get this in! :)
lhutton1
left a comment
There was a problem hiding this comment.
LGTM! Well done with battling the multiple rebases this needed :)
…e#9508) * Current conv2d tests compare the conv2d operator against tvm's execution of the default schedule of conv2d as defined in TOPI and that is not bitexact with tflite runtime's implemention. Therefore a tolerance of "1" in quantized 8-bit domain is used. * Converts the current conv2d tests to use TensorFlow APIs to create a test cases for conv2D and compare against TFLite runtime.
In apache#9508 the decision was made to remove the UnsupportedLayout exception and the checks that throw it, this PR is cleaning up some that remained. Change-Id: I83bfe233381b83af886343c9569db753e33f9059
…e#9508) * Current conv2d tests compare the conv2d operator against tvm's execution of the default schedule of conv2d as defined in TOPI and that is not bitexact with tflite runtime's implemention. Therefore a tolerance of "1" in quantized 8-bit domain is used. * Converts the current conv2d tests to use TensorFlow APIs to create a test cases for conv2D and compare against TFLite runtime.
…e#9508) * Current conv2d tests compare the conv2d operator against tvm's execution of the default schedule of conv2d as defined in TOPI and that is not bitexact with tflite runtime's implemention. Therefore a tolerance of "1" in quantized 8-bit domain is used. * Converts the current conv2d tests to use TensorFlow APIs to create a test cases for conv2D and compare against TFLite runtime.
…e#9508) * Current conv2d tests compare the conv2d operator against tvm's execution of the default schedule of conv2d as defined in TOPI and that is not bitexact with tflite runtime's implemention. Therefore a tolerance of "1" in quantized 8-bit domain is used. * Converts the current conv2d tests to use TensorFlow APIs to create a test cases for conv2D and compare against TFLite runtime.
…e#9508) * Current conv2d tests compare the conv2d operator against tvm's execution of the default schedule of conv2d as defined in TOPI and that is not bitexact with tflite runtime's implemention. Therefore a tolerance of "1" in quantized 8-bit domain is used. * Converts the current conv2d tests to use TensorFlow APIs to create a test cases for conv2D and compare against TFLite runtime.
* [microNPU] Remove remaining UnsupportedLayout checks In #9508 the decision was made to remove the UnsupportedLayout exception and the checks that throw it, this PR is cleaning up some that remained. Change-Id: I83bfe233381b83af886343c9569db753e33f9059 * fix lint Change-Id: I67c1a5371f0b2e51b6cd39435ef4073d8d17af51
manupak
left a comment
There was a problem hiding this comment.
Summarizing the offline conversation we had to w.r.t. removal of the custom exception.
| """This module defines all error types associated with the Arm(R) Ethos(TM)-U NPU code generator.""" | ||
|
|
||
|
|
||
| class EthosUCodegenError(Exception): |
There was a problem hiding this comment.
We decided to remove the layout checks as we decided to rely on partitioning not to partition unsupported layouts to the codegen. Therefore, they are not likely to be exercised from a user flow. Therefore should not be an exception.
Furthermore, it felt unlikely to be triggered in dev flow too to replace them with an assertion -- however, we could revisit if that is experienced frequently.
* [microNPU] Remove remaining UnsupportedLayout checks In apache#9508 the decision was made to remove the UnsupportedLayout exception and the checks that throw it, this PR is cleaning up some that remained. Change-Id: I83bfe233381b83af886343c9569db753e33f9059 * fix lint Change-Id: I67c1a5371f0b2e51b6cd39435ef4073d8d17af51
* [microNPU] Remove remaining UnsupportedLayout checks In apache#9508 the decision was made to remove the UnsupportedLayout exception and the checks that throw it, this PR is cleaning up some that remained. Change-Id: I83bfe233381b83af886343c9569db753e33f9059 * fix lint Change-Id: I67c1a5371f0b2e51b6cd39435ef4073d8d17af51
* [microNPU] Remove remaining UnsupportedLayout checks In apache#9508 the decision was made to remove the UnsupportedLayout exception and the checks that throw it, this PR is cleaning up some that remained. Change-Id: I83bfe233381b83af886343c9569db753e33f9059 * fix lint Change-Id: I67c1a5371f0b2e51b6cd39435ef4073d8d17af51
…e#9508) * Current conv2d tests compare the conv2d operator against tvm's execution of the default schedule of conv2d as defined in TOPI and that is not bitexact with tflite runtime's implemention. Therefore a tolerance of "1" in quantized 8-bit domain is used. * Converts the current conv2d tests to use TensorFlow APIs to create a test cases for conv2D and compare against TFLite runtime.
Previous implementation of conv2d tests would compare the conv2d operator against tvm's execution of the default schedule of conv2d as defined in TOPI, and that is not bitexact with tflite runtime's implemention. Therefore, a tolerance of "1" in quantized 8-bit domain was used.
Converts the current conv2d tests to use TensorFlow APIs to create test cases for conv2D, and compare against TFLite runtime.
Change-Id: I74b4a2a22fe90fa0d9176a65627adf81f127dbd0