<s> from . import _distance <EOL> from . import _morph <EOL> import numpy as np <EOL> __all__ = [ <EOL> '<STR_LIT>' , <EOL> ] <EOL> def distance ( bw , metric = '<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> if bw . dtype != np . bool_ : <EOL> bw = ( bw != <NUM_LIT:0> ) <EOL> f = np . zeros ( bw . shape , np . double ) <EOL> if bw . ndim == <NUM_LIT:2> : <EOL> f [ bw ] = len ( f . shape ) * max ( f . shape ) ** <NUM_LIT:2> + <NUM_LIT:1> <EOL> _distance . dt ( f , None ) <EOL> else : <EOL> f . fill ( f . size * <NUM_LIT:2> ) <EOL> Bc = np . ones ( [ <NUM_LIT:3> for _ in bw . shape ] , bool ) <EOL> _morph . distance_multi ( f , bw , Bc ) <EOL> if metric == '<STR_LIT>' : <EOL> np . sqrt ( f , f ) <EOL> return f </s>
