-
Notifications
You must be signed in to change notification settings - Fork 74.2k
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
[MLIR] Fix verifier for TF::Conv2DOp and TF::Conv3DOp. #44022
Conversation
@smit-hinsu for visibility - as the author of the surrounding code. |
Thanks for the improvements! Could you make use the new inferReturnTypes trait for shape inference? See this commit for an example. edeb469 |
It isn't immediately clear from the other revision as to how inferReturnTypes should be used/incorporated. Could you please expand a bit more on what changes/additions should be made here? Thanks |
Once we declare InferTypeOpInterface interface and implement inferReturnTypes methods for these ops, we don't need to explicitly call shape verification. You should see that shapes are being verified automatically without explicit call to inferReturnTypes. The benefit of this generic approach is that the interface can be shared between buillder, verifier and allows other uses as all the ops follow the same mechanism. Checkout interfaces documentation at https://mlir.llvm.org/docs/Interfaces/. Let me know if you need further explanation or specific details. |
@smit-hinsu , there is an issue in using the |
We need to emit error in that case and fail the type inference. See the following op inference in HLO dialect for an example, |
@pr4tgpt Can you please check @smit-hinsu's comments and keep us posted ? Thanks! |
Yes I am working on smit's suggestion. Thanks. |
Hi @smit-hinsu I have made changes as requested by you. Please review them. Thanks. |
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.
Sorry for the delay in the response. I somehow missed the update mail. Please ping on the review if you don't get an update within 24 hours.
This looks quite good but I have a few suggestions.
Thank you @smit-hinsu for suggestions. Will update the code with relevant changes. |
@pr4tgpt Can you please check @smit-hinsu's comments and keep us posted ? Thanks! |
I have checked and resolved the comments. Thanks. |
Hi @smit-hinsu , I have made changes as requested by you. Please review the changes and feel free to post suggestions/improvements. Thanks! |
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 all the hard work here. We are almost there!
Let me know if any of the comments are not clear and you need further pointer/clarification.
Could you run all the tests in these directories and fix the failing ones? tensorflow/compiler/mlir |
@pr4tgpt Can you please check @smit-hinsu's comments and keep us posted ? Thanks! |
Yes I am looking into this. Thanks! |
Hi @smit-hinsu I checked the tests you asked. The tests in Could you see the failing tests once and tell me what could be the possible reason for them to fail? Thanks! |
Hi @smit-hinsu could you help with this? Thanks! |
All these tests depend on your change. tensorflow/compiler/mlir/tensorflow/tests uses tf-opt tool which links everything andd tensorflow/lite/python links the TF dialect so there are dependencies. There are many tests failing. Following are some of these: tensorflow/compiler/mlir/tensorflow/tests:tf-ops.mlir.test Please take a look. You can use 'tensorflow/compiler/mlir/tensorflow/tests:all' to test all tests in the directory. |
These failures are all clearly related to this PR. An example from
|
This commit addresses a bug where in tf.conv2D and tf.conv3D, incorrect sizes of output shape was not verified. Added changes to verify the output shape and emit error for incorrect output shapes. Signed-off-by: Prateek Gupta <prateek@polymagelabs.com>
In this commit, some of the dead code is removed. Also a duplicate function for verifying convolution attributes is also removed. Signed-off-By: Prateek Gupta<prateek@polymagelabs.com>
Some of the test cases were using wrong output sizes for tf.conv2D. This commit corrects those test cases. Signed-off-by: Prateek Gupta<prateek@polymagelabs.com>
This commit addresses a bug where incorrect filter dimensions were being read and used. Corrected the bug and the relevant test cases were also checked. Signed-off-by: Prateek Gupta <prateek@polymagelabs.com>
Hi @smit-hinsu, @bondhugula I have fixed the code. The filter dimensions were fetched incorrectly. The |
Tests in |
It finally got submitted! Thanks Prateek for the contribution and working through all the issues. |
Thank you Smit for your valuable help and suggestions. |
This commit addresses a bug where in tf.conv2D and tf.conv3D, incorrect sizes of output shape was not verified. Added changes to verify the output shape and emit error for incorrect output shapes.
Signed-off-by: Prateek Gupta prateek@polymagelabs.com