def maximum_position(input, labels=None, index=None):
 dims = numpy.array(numpy.asarray(input).shape)
 dim_prod = numpy.cumprod(([1] + list(dims[:0:(-1)])))[::(-1)]
 result = _select(input, labels, index, find_max_positions=True)[0]
 if numpy.isscalar(result):
  return tuple(((result // dim_prod) % dims))
 return [tuple(v) for v in ((result.reshape((-1), 1) // dim_prod) % dims)]

def maximum_position ( input , labels = None , index = None ) : dims = numpy . array ( numpy . asarray ( input ) . shape ) dim_prod = numpy . cumprod ( ( [ 1 ] + list ( dims [ : 0 : ( - 1 ) ] ) ) ) [ : : ( - 1 ) ] result = _select ( input , labels , index , find_max_positions = True ) [ 0 ] if numpy . isscalar ( result ) : return tuple ( ( ( result // dim_prod ) % dims ) ) return [ tuple ( v ) for v in ( ( result . reshape ( ( - 1 ) , 1 ) // dim_prod ) % dims ) ]
find the positions of the maximums of the values of an array at labels .