@nose.tools.nottest
def pooling_patches(dims, ksize, stride, pad, cover_all):
 if cover_all:
  xss = itertools.product(*[six.moves.range((- p), (((d + p) - k) + s), s) for (d, k, s, p) in six.moves.zip(dims, ksize, stride, pad)])
 else:
  xss = itertools.product(*[six.moves.range((- p), (((d + p) - k) + 1), s) for (d, k, s, p) in six.moves.zip(dims, ksize, stride, pad)])
 return [tuple((slice(max(x, 0), min((x + k), d)) for (x, d, k) in six.moves.zip(xs, dims, ksize))) for xs in xss]

@ nose . tools . nottest def pooling_patches ( dims , ksize , stride , pad , cover_all ) : if cover_all : xss = itertools . product ( * [ six . moves . range ( ( - p ) , ( ( ( d + p ) - k ) + s ) , s ) for ( d , k , s , p ) in six . moves . zip ( dims , ksize , stride , pad ) ] ) else : xss = itertools . product ( * [ six . moves . range ( ( - p ) , ( ( ( d + p ) - k ) + 1 ) , s ) for ( d , k , s , p ) in six . moves . zip ( dims , ksize , stride , pad ) ] ) return [ tuple ( ( slice ( max ( x , 0 ) , min ( ( x + k ) , d ) ) for ( x , d , k ) in six . moves . zip ( xs , dims , ksize ) ) ) for xs in xss ]
return tuples of slices that indicate pooling patches .