title: Numpy sum() got an 'keepdims' error
body: <p>This is a paragraph of a neural network code example:</p>
  
  <pre><code>def forward_step(X, W, b, W2, b2):
      hidden_layer = np.maximum(0, np.dot(X, W) + b)
      scores = np.dot(hidden_layer, W2) + b2
      exp_scores = np.exp(scores)
      probs = exp_scores / np.sum(exp_scores, axis=1, keepdims=True)
      ...
  </code></pre>
  
  <p>The last line of the code shown above threw an error:</p>
  
  <pre><code>&lt;ipython-input-49-d97cff51c360&gt; in forward_step(X, W, b, W2, b2)
       14     scores = np.dot(hidden_layer, W2) + b2
       15     exp_scores = np.exp(scores)
  ---&gt; 16     probs = exp_scores / np.sum(exp_scores, axis=1, keepdims=True)
       17     corect_logprobs = -np.log(probs[range(X.shape[0]), y])
  
  /Users/###/anaconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py in sum(a, axis, dtype, out, keepdims)
     1810             pass
     1811         else:
  -&gt; 1812             return sum(axis=axis, dtype=dtype, out=out, **kwargs)
     1813     return _methods._sum(a, axis=axis, dtype=dtype,
     1814                          out=out, **kwargs)
  
  TypeError: sum() got an unexpected keyword argument 'keepdims'
  </code></pre>
  
  <p>There is a similar question <a href="https://stackoverflow.com/questions/45601131/numpy-sum-keepdims-error">Numpy sum keepdims error</a> which says that the edition of numpy should be greater than 1.7. I have checked my edition of numpy:</p>
  
  <pre><code>import numpy
  numpy.version.version
  &gt;&gt; 1.12.1
  </code></pre>
  
  <p>Now I am confused about how this error occurred.</p>