@staticmethod
    def numpy_max_pool_2d(input, ds, ignore_border=False, mode='max'):
        if len(input.shape) < 2:
            raise NotImplementedError('input should have at least 2 dim,'
                                      ' shape is %s'
                                      % str(input.shape))
        xi = 0
        yi = 0
        if not ignore_border:
            if input.shape[-2] % ds[0]:
                xi += 1
            if input.shape[-1] % ds[1]:
                yi += 1
        out_shp = list(input.shape[:-2])
        out_shp.append(input.shape[-2] / ds[0] + xi)
        out_shp.append(input.shape[-1] / ds[1] + yi)
        output_val = numpy.zeros(out_shp)
        func = numpy.max
        if mode == 'sum':
            func = numpy.sum
        elif mode != 'max':
            func = numpy.average

        for k in numpy.ndindex(*input.shape[:-2]):
            for i in range(output_val.shape[-2]):
                ii = i * ds[0]
                for j in range(output_val.shape[-1]):
                    jj = j * ds[1]
                    patch = input[k][ii:ii + ds[0], jj:jj + ds[1]]
                    output_val[k][i, j] = func(patch)
        return output_val
Function to return if host is SmartOS (Illumos) global zone or not
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/tensor/signal/tests/test_pool.py/TestDownsampleFactorMax.numpy_max_pool_2d--crossover with--dataset/ETHPy150Open saltstack/salt/salt/utils/__init__.py/is_smartos_globalzone