ajayunagar
(Ajay Unagar)
April 30, 2017, 12:05pm
1
Hi all,
I was reading fractional Max-Pooling few days back.(https://arxiv.org/pdf/1412.6071.pdf )
Then I found out that, it was implemented in old Torch version. But it’s not available in PyTorch. Are we planning to add this? I’m ready to try it out. @smth ?
1 Like
smth
April 30, 2017, 12:08pm
2
We haven’t exposed this at the Python level. What’s missing is that we need to write Python wrapper for this, similar to:
local SpatialFractionalMaxPooling, parent =
torch.class('nn.SpatialFractionalMaxPooling', 'nn.Module')
-- Usage:
-- nn.SpatialFractionalMaxPooling(poolSizeW, poolSizeH, outW, outH)
-- the output should be the exact size (outH x outW)
-- nn.SpatialFractionalMaxPooling(poolSizeW, poolSizeH, ratioW, ratioH)
-- the output should be the size (floor(inH x ratioH) x floor(inW x ratioW))
-- ratios are numbers between (0, 1) exclusive
function SpatialFractionalMaxPooling:__init(poolSizeW, poolSizeH, arg1, arg2)
parent.__init(self)
assert(poolSizeW >= 2)
assert(poolSizeH >= 2)
-- Pool size (how wide the pooling for each output unit is)
self.poolSizeW = poolSizeW
self.poolSizeH = poolSizeH
-- Random samples are drawn for all
-- batch * plane * (height, width; i.e., 2) points. This determines
This file has been truncated. show original
import torch
from torch.autograd import Variable
from .module import Module
from .utils import _single, _pair, _triple
from .. import functional as F
class MaxPool1d(Module):
r"""Applies a 1D max pooling over an input signal composed of several input
planes.
In the simplest case, the output value of the layer with input size :math:`(N, C, L)`
and output :math:`(N, C, L_{out})` can be precisely described as:
.. math::
\begin{array}{ll}
out(N_i, C_j, k) = \max_{{m}=0}^{{kernel\_size}-1} input(N_i, C_j, stride * k + m)
\end{array}
This file has been truncated. show original
It’s a low priority task, but we’ll eventually expose it.
If you want to give a hand at implementing the wrapper, we’d love a contribution
2 Likes