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 count_include_pad support to AvgPool #1163

Merged
merged 3 commits into from May 17, 2018

Conversation

nishi-t
Copy link
Contributor

@nishi-t nishi-t commented May 17, 2018

This PR addressed #1144

I confirmed same result as pytorch using following code:
https://gist.github.com/nishi-t/f1c283f176b073b038338dc2ff044ecf

@@ -42,7 +42,8 @@ def global_pool(data, pool_type, layout="NCHW"):
return cpp.nn.global_pool(data, POOL_TYPE_CODE[pool_type], layout)


def pool(data, kernel, stride, padding, pool_type, ceil_mode=False, layout="NCHW"):
def pool(data, kernel, stride, padding, pool_type, ceil_mode=False, layout="NCHW",
Copy link
Member

Choose a reason for hiding this comment

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

when there are multiple lines, let us break it into one argument per line

if (count_include_pad) {
return tsum(output) / (kernel_height * kernel_width);
} else {
auto h_start = output[height_axis] * stride_height - padding_height;
Copy link
Member

Choose a reason for hiding this comment

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

prefer Expr to auto, when we know the type and can type it out easily

@tqchen
Copy link
Member

tqchen commented May 17, 2018

Thanks for the contribution! this is merged

@tqchen tqchen merged commit 3327ac4 into apache:master May 17, 2018
@nishi-t nishi-t deleted the count_include_pad branch May 17, 2018 23:52
tqchen pushed a commit to tqchen/tvm that referenced this pull request Jul 6, 2018
* Add count_include_pad support to AvgPool

* Fix python_cpp/test_topi_pooling.py

* Change auto to explicitly type, and fix format.
grwlf pushed a commit to grwlf/tvm that referenced this pull request Aug 8, 2018
* Add count_include_pad support to AvgPool

* Fix python_cpp/test_topi_pooling.py

* Change auto to explicitly type, and fix format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants