Closed JustinhoCHN closed 6 years ago
Thanks for the report @JustinhoCHN -- would you like to submit a PR to fix?
@karmel After double check, I found that this problem won't occur in the newest release, I remembered that this bug was found in the 1.8.0 version, do we still need to submit the PR for that version?
No, if it is fixed, we can leave as-is. Thanks-- closing this.
System information
python cifar10_main.py
You can collect some of this information using our environment capture script:
https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh
You can obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
Describe the problem
In the official resnet code(cifar10) , the default batch_size is 64, since the images' size in cifar10 is small, we can use bigger batch_size, but when I want to change the batch_size to 16, it'll raise the dimension mismatch error:
After debugging, I found that the 'final_size' of the resnet was hard-coded, in
resnet_model.py
line 472:-1 means the batch_size, the batch_size is calculated by
4096 // self.final_size
, it must be match with the default batch_size(64), so theself.final_size
was hard-coded to 64 (4096//batch_size=64), as you can see incifar10_main.py
line 187:But if you want to change the batch_size, you have to also change the final_size of the resnet, otherwise it'll raise dimension mismatch error, but there's no notes to remind us to do that!
Advice
Don't hard-coded the final_size, we can calculate the final_size before we put that in model building function,
Source code / logs