def conv_input_length(output_length, filter_size, stride, pad=0):
 if (output_length is None):
  return None
 if (pad == 'valid'):
  pad = 0
 elif (pad == 'full'):
  pad = (filter_size - 1)
 elif (pad == 'same'):
  pad = (filter_size // 2)
 if (not isinstance(pad, int)):
  raise ValueError('Invalid pad: {0}'.format(pad))
 return ((((output_length - 1) * stride) - (2 * pad)) + filter_size)

def conv_input_length ( output_length , filter_size , stride , pad = 0 ) : if ( output_length is None ) : return None if ( pad == 'valid' ) : pad = 0 elif ( pad == 'full' ) : pad = ( filter_size - 1 ) elif ( pad == 'same' ) : pad = ( filter_size // 2 ) if ( not isinstance ( pad , int ) ) : raise ValueError ( 'Invalid pad: {0}' . format ( pad ) ) return ( ( ( ( output_length - 1 ) * stride ) - ( 2 * pad ) ) + filter_size )
helper function to compute the input size of a convolution operation this function computes the length along a single axis .