-
Notifications
You must be signed in to change notification settings - Fork 74k
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
[BUG] Default MaxPoolingOp/AvgPoolingOp only supports NHWC #15364
Comments
@zheng-xq Can you comment on this? Maybe we should update docs to say that all data formats are not supported? Thanks... |
For now, many kernels only supports NCHW on GPU. In the future, we are introducing a layout optimizer so models can use NHWC and still get the best performance as if they are written for NCHW. |
@zheng-xq Thanks. |
@andydavis1 we could do it, or if @zheng-xq wants to submit a PR fixing the docs that would also work? You just need to update the doc string in https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/nn_ops.py |
@zheng-xq |
Both formats are supported, with very different performance characteristics. That's why it is important to use the faster format. |
Just to clear some potential confusion around this. If you compile tensorflow with MKL support you can use these ops with |
@zheng-xq has there been progress on a layout optimizer? Is NCHW now supported? |
I think you are getting this error because of the code you provided. You are trying to max pool from numpy array. When I run your code I got the same error. When modified it is working properly. import numpy as np
import tensorflow as tf
a = tf.random_uniform((1, 3,10,10))
b = tf.nn.max_pool(a, ksize=[1, 1, 2, 2], strides=[1, 1, 1, 1], padding='VALID', data_format='NCHW')
sess=tf.InteractiveSession()
sess.run(tf.global_variables_initializer())
res = sess.run(b)
print(res.shape) |
I think this may tie to this |
ping @yongtang, please see the comment of @KleinYuan |
Closing due to staleness. Please check with the latest version of TensorFlow. Feel free to reopen if the issue still persists. Thanks! |
I tried all the aforementioed methods. nevertheless of these methods were overcome this bug. I still have had the same issue: When I trying to execute this code in jupyter notebooke: Traininghist = model.fit(X_train, y_train, batch_size=16, epochs=num_epoch, verbose=1, validation_data=(X_test, y_test)) |
|
I tried all methods, but still cant solve this error. Please help me with this code: error: InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU Function call stack: |
pip install intel-tensorflow==2.3.0 |
System information
Describe the problem
When I try to run a node of type max or avg pool with data_format : 'NCHW' I got an error.
This seems to be a bug because the TF docs affirms that :
Error logs
With max:
With Avg:
The text was updated successfully, but these errors were encountered: