-
Notifications
You must be signed in to change notification settings - Fork 617
Speed up mean_filter2d with depthwise_conv2d #235
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d4a10fe
speed up mean_filter2d with depthwise_conv2d
WindQAQ 51b18f6
cast the output back to the original dtype
WindQAQ 6e4d2d6
Merge branch 'master' of https://github.com/tensorflow/addons into sp…
WindQAQ ea10aac
refactor test cases
WindQAQ 498d365
avoid loss of precision
WindQAQ 39ae5a3
add test case with channels of None
WindQAQ 2fddf16
add doc of _tile_image
WindQAQ 8e69083
use ones instead of random data
WindQAQ 94389b8
add test case with 4x4 filter
WindQAQ e1aca51
add doc related to padding
WindQAQ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we add an unit test for even shape, say (4, 4), and make sure the result is the same with scipy?
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.
Should we import scipy for test here?
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.
I could add a test case to check whether the output of explicitly zero padding is the same with the one of native "SAME" padding supported by depthwise_conv2d if we really do not want to compare the result produced by other packages.
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.
Hi, Tzu-Wei, perhaps we don't have to import scipy. Can we rename test_reflect_padding to test_reflect_padding_with_3x3_filter, and create an new test_reflect_padding_with_4x4_filter in the same way?
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.
Hi, Facai, after a rough test, I found the padding method (or the anchor of even-sized kernel) of tensorflow seems different from the one of scipy. Here is the testing notbook. Take 4x4 filter for example. The explicit (zero) padding could yield the same result with implicit SAME padding supported by depthwise_conv2d. However, I have to adjust
originargument in scipy's implement to (-1, -1) so that it could produce the same result. In this case, should we follow the scipy's implementation or match the implicit padding in tensorflow?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.
BTW,
scipy's reflect padding => (c b a | a b c d | d c b)
TF's reflect padding => (d c b | a b c d | c b a)
TF's reflect padding = scipy's mirror padding
scipy's reflect padding = TF's symmetric padding
Seems that they have different meaning...
https://www.tensorflow.org/api_docs/python/tf/pad
Uh oh!
There was an error while loading. Please reload this page.
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.
Hi, Tzu-Wei,
tf.padkeeps consistent withnp.pad. And similarity, we can either keep compatible with scipy, or write a detailed document.Both are fine for me. cc @seanpmorgan Sean, what's your opinion?
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.
Sure :-) In either way, it should be more docs there so let me write some details in this version first.