-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[microNPU] Update Conv2D Tests to Use TF API to Gen Test Cases #9508
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleaning this up @dchauhan-arm ! Much appreciated :).
Broadly looks good and few suggestions to improve it a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a good point -- lets follow up with another PR to improve coverage.
Update ordering of imports
Remove unused import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :) It needs to be rebased on top of #9597, but otherwise mostly looks good!
Address comments, use infra.py function to compute ofm_shape
Missing square brackets in parametrization, missing underscores.
b86add3
to
40da2da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's get this in! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Well done with battling the multiple rebases this needed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!.
Thanks for the hard work! and congratulations on getting your first PR in 🎉 .
I think we need to follow up to use a similiar structure as other tests (after @mbaret's refactor).
to be consistent.
…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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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