Skip to content
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

Add MaxUnpooling2DV2 layer #2594

Merged
merged 4 commits into from
Nov 16, 2021
Merged

Conversation

midsterx
Copy link
Contributor

@midsterx midsterx commented Nov 1, 2021

Description

Add MaxUnpooling2DV2 layer.
The max_pool_with_argmax function can map several input sizes to the same output size. Hence, to avoid ambiguity in the inversion process, the stride and padding arguments have been replaced by the output_size argument. This has been done in a new layer rather than in the existing MaxUnpooling2D class to avoid compatibility issues.

Type of change

Checklist:

  • I've properly formatted my code according to the guidelines
    • By running Black + Flake8
    • By running pre-commit hooks
  • This PR addresses an already submitted issue for TensorFlow Addons
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • This PR contains modifications to C++ custom-ops

How Has This Been Tested?

I run the layer_test

@boring-cyborg boring-cyborg bot added layers test-cases Related to Addons tests labels Nov 1, 2021
@google-cla google-cla bot added the cla: yes label Nov 1, 2021
@midsterx
Copy link
Contributor Author

midsterx commented Nov 6, 2021

@tensorflow/sig-addons-maintainers, @thaink - could one of you take a look at this PR?
Thanks!

thaink
thaink previously approved these changes Nov 8, 2021
Copy link
Member

@thaink thaink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

@@ -0,0 +1,97 @@
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2021

@@ -0,0 +1,134 @@
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2021

Copy link
Contributor Author

@midsterx midsterx Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing this out @thaink, I have corrected the year in both files.

@thaink
Copy link
Member

thaink commented Nov 8, 2021

@WindQAQ @seanpmorgan Can you take a look at this PR?

from tensorflow_addons.layers.max_unpooling_2d_v2 import MaxUnpooling2DV2


@pytest.mark.usefixtures("maybe_run_functions_eagerly")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a tflite test case too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide some clarity regarding this?
Did you mean something like @pytest.mark.with_device(["cpu", "gpu", tf.distribute.MirroredStrategy])?

"""Unpool the outputs of a maximum pooling operation."""
output_size_attr = " ".join(["i: %d" % v for v in output_size])
experimental_implements = [
'name: "addons:MaxUnpooling2DV2"',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this @fsx950223.
It is not available, and I have removed it from the PR.

@fsx950223
Copy link
Member

Thanks for the PR.

fsx950223
fsx950223 previously approved these changes Nov 15, 2021
@fsx950223
Copy link
Member

You should update codeowner too.

@midsterx
Copy link
Contributor Author

You should update codeowner too.

I added myself to .github/CODEOWNERS.
Thanks!

@fsx950223 fsx950223 merged commit 3966935 into tensorflow:master Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants