Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: '>' not supported between instances of 'NoneType' and 'int' #9

Open
vishwa94sai opened this issue Jun 11, 2020 · 0 comments

Comments

@vishwa94sai
Copy link

/usr/local/lib/python3.6/dist-packages/tf_metrics/init.py in precision(labels, predictions, num_classes, pos_indices, weights, average)
40 """
41 cm, op = _streaming_confusion_matrix(
---> 42 labels, predictions, num_classes, weights)
43 pr, _, _ = metrics_from_confusion_matrix(
44 cm, pos_indices, average=average)

/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/metrics_impl.py in _streaming_confusion_matrix(labels, predictions, num_classes, weights)
262
263 # Flatten the input if its rank > 1.
--> 264 if predictions.get_shape().ndims > 1:
265 predictions = array_ops.reshape(predictions, [-1])
266

TypeError: '>' not supported between instances of 'NoneType' and 'int'

In python 3, the comparison operators raise an error. Refer to -> https://docs.python.org/3/whatsnew/3.0.html#ordering-comparisons
The ordering comparison operators (<, <=, >=, >) raise a TypeError exception when the operands don’t have a meaningful natural ordering. Thus, expressions like 1 < '', 0 > None or len <= len are no longer valid, and e.g. None < None raises TypeError instead of returning False. A corollary is that sorting a heterogeneous list no longer makes sense – all the elements must be comparable to each other. Note that this does not apply to the == and != operators: objects of different incomparable types always compare unequal to each other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant