'Forward propagate pooling layer.
Arguments:
layer (PoolLayer): The pool layer object, different backends have
different pool layers.
I (Tensor): Input tensor.
O (Tensor): output tensor.
argmax (Tensor): tensor to store location of the maximum'

def fprop_pool(self, layer, I, O, argmax=None, beta=0.0):

    assert (layer.sizeI == I.size)
    assert (layer.sizeO == O.size)
    assert ((layer.op == 'max') or (layer.op == 'avg'))
    if (layer.op == 'max'):
        assert (layer.sizeO == argmax.size)
    (J, T, R, S) = layer.JTRS
    (C, D, H, W, N) = layer.dimI
    (K, M, P, Q, N) = layer.dimO
    (pad_c, pad_d, pad_h, pad_w) = layer.padding
    (str_c, str_d, str_h, str_w) = layer.strides
    if ((J > 1) or (T > 1) or (D > 1)):
        super(NervanaMKL, self).fprop_pool(layer, I, O, argmax, beta)
        return
    if (layer.op == 'max'):
        bMax = 1
    elif (layer.op == 'avg'):
        bMax = 0
    if self.check_caffe_compat():
        bCeil = 1
    else:
        bCeil = 0
    primitives = c_longlong(layer.dnnPrimitives.ctypes.data)
    self.mklEngine.MaxPooling_fprop(I.get_prim(), O.get_prim(), primitives, layer.initOk_f, bMax, N, C, H, W, R, S, str_h, str_w, pad_h, pad_w, K, P, Q, bCeil)
    layer.initOk_f = 1
    O.shape5D = layer.dimO
