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

backend cntk: TypeError: '<' not supported between instances of 'Function' and 'float' #8821

Closed
mw66 opened this issue Dec 17, 2017 · 1 comment

Comments

@mw66
Copy link

mw66 commented Dec 17, 2017

just run the example from keras:

$ python examples/mnist_siamese.py
Using CNTK backend
Selected GPU[0] Tesla K40c as the process wide default device.
Traceback (most recent call last):
File "examples/mnist_siamese.py", line 128, in
model.compile(loss=contrastive_loss, optimizer=rms, metrics=[accuracy])
File "/home/xxx/project/keras/keras/engine/training.py", line 934, in compile
handle_metrics(output_metrics)
File "/home/xxx/project/keras/keras/engine/training.py", line 931, in handle_metrics
mask=masks[i])
File "/home/xxx/project/keras/keras/engine/training.py", line 459, in weighted
score_array = fn(y_true, y_pred)
File "examples/mnist_siamese.py", line 91, in accuracy
return K.mean(K.equal(y_true, K.cast(y_pred < 0.5, y_true.dtype)))
TypeError: '<' not supported between instances of 'Function' and 'float'

Using CNTK backend
keras.version = '2.1.1'

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

$ python -c "import cntk; print(cntk.version)"
2.3.1

@gabrieldemarmiesse
Copy link
Contributor

Hi!

This isn't really a bug. It's because you can't use comparaison operators with the cntk backend.
Source: discussion during the cntk integration. #6800
You should use K.greater_than() instead.

If it solves your problem, feel free to close the issue.

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

3 participants