'Backward propagate pooling layer.
Arguments:
layer (PoolLayer): The pool layer object. Different backends have
different pool layers.
I (Tensor): Input (error) tensor.
O (Tensor): Output (delta) tensor.
argmax (Tensor): tensor to store location of the maximum
alpha (float): linear scaling (does not work for l2 pooling)
beta (float): accumulation value into grad_I'

def bprop_pool(self, layer, I, O, argmax=None, alpha=1.0, beta=0.0):

    assert (layer.sizeI == O.size)
    assert (layer.sizeO == I.size)
    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).bprop_pool(layer, I, O, argmax, alpha, beta)
        return
    primitives = c_longlong(layer.dnnPrimitives.ctypes.data)
    self.mklEngine.MaxPooling_bprop(I.get_prim(), O.get_prim(), primitives, layer.initOk_b)
    layer.initOk_b = 1
    O.shape5D = layer.dimI
