If one or more of your axes are of length one, you can remove those axes using numpy.squeeze.
numpy.squeeze
Link to previous tips on NumPy.