def ymax(y):
 y1 = y.ravel()
 maxy1 = np.amax(y1)
 e1 = np.exp((y1 - maxy1))
 p1 = (e1 / np.sum(e1))
 y1 = np.log((1e-20 + p1))
 ix = np.argmax(y1)
 return (ix, y1[ix])

def ymax ( y ) : y1 = y . ravel ( ) maxy1 = np . amax ( y1 ) e1 = np . exp ( ( y1 - maxy1 ) ) p1 = ( e1 / np . sum ( e1 ) ) y1 = np . log ( ( 1e-20 + p1 ) ) ix = np . argmax ( y1 ) return ( ix , y1 [ ix ] )
simple helper function here that takes unnormalized logprobs .