Python: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future

I assume the error occurs in this expression:

np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1))

can you tell us something about the 2 arrays, predictions, labels? The usual stuff - dtype, shape, some sample values. Maybe go the extra step and show the np.argmax(...) for each.

In numpy you can compare arrays of the same size, but it has become pickier about comparing arrays that don't match in size:

In [522]: np.arange(10)==np.arange(5,15)
Out[522]: array([False, False, False, False, False, False, False, False, False, False], dtype=bool)
In [523]: np.arange(10)==np.arange(5,14)
/usr/local/bin/ipython3:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
  #!/usr/bin/python3
Out[523]: False

This error is telling you that the comparisson you're performing doesn't really make sense, since both arrays have different shapes, hence it can't perform elementwise comparisson. Here's an example:

x = np.random.randint(0,5,(3,2))
y = np.random.randint(0,5,(5,7))

Where attempting to do x==y will yield:

DeprecationWarning: elementwise comparison failed; this will raise an error in the future. x==y

The right way to do this, would be to use np.array_equal, which checks equality of both shape and elements:

np.array_equal(x,y)
# False

In the case of floats, np.allclose is more suited, since it allows to control both the relative and absolute tolerance of the comparisson result. Here's an example:

x = np.random.random((400,34))
y = x.round(6)

np.array_equal(x,y)
# False
np.allclose(x,y)
# False
np.allclose(x,y, atol=1e-05)
# True