{"action":"closed","issue":{"url":"https://api.github.com/repos/apache/incubator-mxnet/issues/9714","repository_url":"https://api.github.com/repos/apache/incubator-mxnet","labels_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/9714/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/9714/comments","events_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/9714/events","html_url":"https://github.com/apache/incubator-mxnet/issues/9714","id":294763897,"number":9714,"title":"Does global pooling support padding?","user":{"login":"TaoLv","id":22437510,"avatar_url":"https://avatars2.githubusercontent.com/u/22437510?v=4","gravatar_id":"","url":"https://api.github.com/users/TaoLv","html_url":"https://github.com/TaoLv","followers_url":"https://api.github.com/users/TaoLv/followers","following_url":"https://api.github.com/users/TaoLv/following{/other_user}","gists_url":"https://api.github.com/users/TaoLv/gists{/gist_id}","starred_url":"https://api.github.com/users/TaoLv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TaoLv/subscriptions","organizations_url":"https://api.github.com/users/TaoLv/orgs","repos_url":"https://api.github.com/users/TaoLv/repos","events_url":"https://api.github.com/users/TaoLv/events{/privacy}","received_events_url":"https://api.github.com/users/TaoLv/received_events","type":"User","site_admin":false},"labels":[{"id":273991937,"url":"https://api.github.com/repos/apache/incubator-mxnet/labels/C++","name":"C++","color":"0052cc","default":false},{"id":707556574,"url":"https://api.github.com/repos/apache/incubator-mxnet/labels/Operator","name":"Operator","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-06T13:44:00Z","updated_at":"2018-03-19T07:28:43Z","closed_at":"2018-03-19T07:28:43Z","author_association":"CONTRIBUTOR","body":"Currently, when do global pooling in mxnet (with param.global_pool=True):\r\n- input kernel size will be reset as input size (H, W);\r\n- stride size will be reset to 1 for 1D, to (1, 1) for 2D;\r\n- padding size will be set as what users input;\r\n- output shape will be (N, C, 1) or (N, C, 1, 1) for 2D;\r\n\r\nPlease kindly find pooling code [here](https://github.com/apache/incubator-mxnet/blob/master/src/operator/nn/pooling-inl.h#L101):\r\n```\r\n    pool(s, in_data[pool_enum::kData].dptr<DType>(),\r\n         in_data[pool_enum::kData].shape_,\r\n         out_data[pool_enum::kOut].shape_,\r\n         param_.global_pool?\r\n           TShape(ishape.data()+ishape.ndim()-param_.kernel.ndim(), ishape.data()+ishape.ndim())\r\n           : param_.kernel,  // reset kernel size for global pooling\r\n         param_.pad,  // padding size\r\n         param_.global_pool? TShape(param_.kernel.ndim()) : param_.stride, // reset stride size\r\n         param_.pool_type,\r\n         req[pool_enum::kOut],\r\n         out_data[pool_enum::kOut].dptr<DType>());\r\n```\r\n\r\nTo my understanding, global pooling should aways be no padding or with padding size 0 and just do computation on the whole image or feature map. If user inputs a padding size (2, 2) to a global average pooling, I doubt that the current implementation will give a wrong output. (Maybe the result is the average of (-2, -2) to (H-2, W-2) in input image or feature map).\r\n\r\nIf global pooling with padding is a supported feature in mxnet, I think I need to change the code of mkldnn pooling to align with that. Otherwise, maybe we need change code to reset padding size to zero if a non-zero padding size is given to global pooling.\r\n\r\nA simple test case is attached for your information.\r\n[test_pool.txt](https://github.com/apache/incubator-mxnet/files/1699227/test_pool.txt)\r\n"}}
{"actor":{"display_login":"TaoLv"}}