def pool_output_length(input_length, pool_size, stride, pad, ignore_border):
 if ((input_length is None) or (pool_size is None)):
  return None
 if ignore_border:
  output_length = (((input_length + (2 * pad)) - pool_size) + 1)
  output_length = (((output_length + stride) - 1) // stride)
 else:
  assert (pad == 0)
  if (stride >= pool_size):
   output_length = (((input_length + stride) - 1) // stride)
  else:
   output_length = (max(0, ((((input_length - pool_size) + stride) - 1) // stride)) + 1)
 return output_length

def pool_output_length ( input_length , pool_size , stride , pad , ignore_border ) : if ( ( input_length is None ) or ( pool_size is None ) ) : return None if ignore_border : output_length = ( ( ( input_length + ( 2 * pad ) ) - pool_size ) + 1 ) output_length = ( ( ( output_length + stride ) - 1 ) // stride ) else : assert ( pad == 0 ) if ( stride >= pool_size ) : output_length = ( ( ( input_length + stride ) - 1 ) // stride ) else : output_length = ( max ( 0 , ( ( ( ( input_length - pool_size ) + stride ) - 1 ) // stride ) ) + 1 ) return output_length
compute the output length of a pooling operator along a single dimension .