-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Resnet: Default AvgPoolingOp only supports NHWC. #263
Comments
TensorFlow only supports NHWC on cpu. |
Thank you very much, that solved the Issue. |
Hello, Now I'm getting error:
Please help me for the same. I need to train cifar10-resnet.py on CPU. I don't have GPU with me. |
|
Can you please help me with changes @ppwwyyxx ? I'm stuck on this for long now. Don't know where to make the changes for this to run on CPU. All the help is appreciated! |
If you can understand tensorflow symbolic code, the changes are easy to identify in |
@ppwwyyxx I already made the necessary changes in
error occurs. Shapes should have nothing to do with GPU/CPU I guess. |
Shapes should have something to do with data_format, for sure. |
diff --git i/examples/ResNet/cifar10-resnet.py w/examples/ResNet/cifar10-resnet.py
index d2cbc6c..764ca75 100755
--- i/examples/ResNet/cifar10-resnet.py
+++ w/examples/ResNet/cifar10-resnet.py
@@ -48,12 +48,10 @@ class Model(ModelDesc):
def _build_graph(self, inputs):
image, label = inputs
image = image / 128.0
- assert tf.test.is_gpu_available()
- image = tf.transpose(image, [0, 3, 1, 2])
def residual(name, l, increase_dim=False, first=False):
shape = l.get_shape().as_list()
- in_channel = shape[1]
+ in_channel = shape[3]
if increase_dim:
out_channel = in_channel * 2
@@ -68,12 +66,12 @@ class Model(ModelDesc):
c2 = Conv2D('conv2', c1, out_channel)
if increase_dim:
l = AvgPooling('pool', l, 2)
- l = tf.pad(l, [[0, 0], [in_channel // 2, in_channel // 2], [0, 0], [0, 0]])
+ l = tf.pad(l, [[0, 0], [0, 0], [0, 0], [in_channel // 2, in_channel // 2]])
l = c2 + l
return l
- with argscope([Conv2D, AvgPooling, BatchNorm, GlobalAvgPooling], data_format='NCHW'), \
+ with argscope([Conv2D, AvgPooling, BatchNorm, GlobalAvgPooling], data_format='NHWC'), \
argscope(Conv2D, nl=tf.identity, use_bias=False, kernel_shape=3,
W_init=variance_scaling_initializer(mode='FAN_OUT')):
l = Conv2D('conv0', image, 16, nl=BNReLU) |
@ppwwyyxx Thanks a ton! You're a savior. Works well now. |
@ppwwyyxx |
@Superlee506 When reporting problems please following the issue template. Thanks! |
@ppwwyyxx Ok |
When running
python examples/ResNet/cifar10-resnet.py
I get following error messageInvalidArgumentError (see above for traceback): Default AvgPoolingOp only supports NHWC.
I tried it using tensorflow 1.0 and 1.1. Also with tag 0.1.8 and 0.1.9. The full error message is as following:
The text was updated successfully, but these errors were encountered: