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 Sparse MaxPool3D #42130

Merged
merged 35 commits into from
Apr 26, 2022
Merged

Add Sparse MaxPool3D #42130

merged 35 commits into from
Apr 26, 2022

Conversation

zkh2016
Copy link
Contributor

@zkh2016 zkh2016 commented Apr 22, 2022

PR types

New features

PR changes

APIs

Describe

  1. 新增paddle.sparse.MaxPool3D
  2. 新增paddle.sparse.functional.max_pool3d
  3. sparse的max_pool3d和dense的定义相同,只是输入是SparseCooTensor
  4. 当前只支持SparseCooTensor,layout=NDHWC
  5. 修复to_dense得到错误layout的bug

英文文档:
image
image

@paddle-bot-old
Copy link

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

xingfeng01
xingfeng01 previously approved these changes Apr 24, 2022
from paddle.fluid.framework import _test_eager_guard


class TestMaxPool3DFunc(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

后续增加一些测试

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

data_format="NDHWC",
name=None):
"""
This API implements sparse max pooling 3d operation.
Copy link
Contributor

Choose a reason for hiding this comment

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

This API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

"""
This API implements sparse max pooling 3d operation.
See more details in :ref:`api_sparse_pooling_MaxPool3d` .
Args:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a blank line before Args

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Returns:
Tensor: The output tensor of pooling result. The data type is same as input tensor.

Raises:
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete Raises

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

data_format="NDHWC",
name=None):
"""
This API implements sparse max pooling 3d operation.
Copy link
Contributor

Choose a reason for hiding this comment

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

As above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


# max pool3d
input = paddle.randn((1, 3, 32, 32, 2))
MaxPool3D = nn.MaxPool3D(kernel_size=2,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use paddle.sparse.MaxPool3D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除pool.py

@@ -0,0 +1,101 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

rm this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已留pooling.py,删pool.py

python/paddle/sparse/layer/pooling.py Show resolved Hide resolved
Copy link
Contributor

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

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

LGTM for API docs

@zkh2016 zkh2016 merged commit 18e9aaf into PaddlePaddle:develop Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants