def dilate(input, factors):
 output = np.zeros(tuple(((((s - 1) * f) + 1) for (s, f) in zip(input.shape, factors))), dtype=input.dtype)
 output[[slice(None, None, factor) for factor in factors]] = input
 return output

def dilate ( input , factors ) : output = np . zeros ( tuple ( ( ( ( ( s - 1 ) * f ) + 1 ) for ( s , f ) in zip ( input . shape , factors ) ) ) , dtype = input . dtype ) output [ [ slice ( None , None , factor ) for factor in factors ] ] = input return output
inserts factors[i] - 1 zeros between input elements on axis i .