title: numpy: how to get a max from an argmax result
body: <p>I have a numpy array of arbitrary shape, e.g.:</p>
  
  <pre><code>a = array([[[ 1,  2],
              [ 3,  4],
              [ 8,  6]],
  
            [[ 7,  8],
             [ 9,  8],
             [ 3, 12]]])
  a.shape = (2, 3, 2)
  </code></pre>
  
  <p>and a result of argmax over the last axis:</p>
  
  <pre><code>np.argmax(a, axis=-1) = array([[1, 1, 0],
                                 [1, 0, 1]])
  </code></pre>
  
  <p>I'd like to get max:</p>
  
  <pre><code>np.max(a, axis=-1) = array([[ 2,  4,  8],
                              [ 8,  9, 12]])
  </code></pre>
  
  <p>But without recalculating everything. I've tried:</p>
  
  <pre><code>a[np.arange(len(a)), np.argmax(a, axis=-1)]
  </code></pre>
  
  <p>But got:</p>
  
  <pre><code>IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (2,) (2,3) 
  </code></pre>
  
  <p>How to do it? Similar question for 2-d: <a href="https://stackoverflow.com/questions/23584157/numpy-2d-array-max-argmax">numpy 2d array max/argmax</a></p>