nyukat / breast_cancer_classifier

Deep Neural Networks Improve Radiologists' Performance in Breast Cancer Screening
https://ieeexplore.ieee.org/document/8861376
GNU Affero General Public License v3.0
844 stars 269 forks source link

Tensorflow Error: Default MaxPoolingOp only supports NHWC on device type CPU #34

Closed sw-dev-code closed 4 years ago

sw-dev-code commented 4 years ago

I'm running the run_single_tf.shwith CPU device type and following error occurs:

2020-06-12 14:28:39.745875: E tensorflow/core/common_runtime/executor.cc:624] Executor failed to create kernel. Invalid argument: Default MaxPoolingOp only supports NHWC on device type CPU
     [[{{node model/resnet/first/max_pooling2d/MaxPool}}]]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1334, in _do_call
    return fn(*args)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
     [[{{node model/resnet/first/max_pooling2d/MaxPool}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "src/modeling/run_model_single_tf.py", line 224, in <module>
    main()
  File "src/modeling/run_model_single_tf.py", line 220, in main
    run(parameters)
  File "src/modeling/run_model_single_tf.py", line 171, in run
    y_hat = sess.run(y, feed_dict={x: x_data})
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 929, in run
    run_metadata_ptr)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1152, in _run
    feed_dict_tensor, options, run_metadata)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1328, in _do_run
    run_metadata)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1348, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
     [[node model/resnet/first/max_pooling2d/MaxPool (defined at /home/user/Projects/Dok/git/breast_cancer_classifier/src/modeling/models_tf.py:133) ]]

How can I solve this issue?

kjgeras commented 4 years ago

I don't know the answer to your question but it also doesn't seem to be related to our repository. Please copy and paste "Default MaxPoolingOp only supports NHWC on device type CPU" into Google and you will find a lot of discussion on this error message.

sw-dev-code commented 4 years ago

@kjgeras Are you able to run run_single_tf.sh in CPU mode with success?

kjgeras commented 4 years ago

Of course. We tested it before putting it online.