Programmers learn & share
0 votes
685 views

Problem :

I am finding solution on following issue
deprecationwarning: elementwise == comparison failed; this will raise an error in the future.
by (6.9k points)   | 685 views

1 Answer

0 votes

Solution :

I guess the error occurs in this expression:

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

In numpy you can compare arrays of the same size only  but it is treaky when it comes to comparing arrays that do not match in size:

e.g.

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
by (36.1k points)  
2,245 questions
2,807 answers
60 comments
241 users