Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

own dataset: Shapes (64, 4, 4, 256) and (64, 3, 3, 256) are not compatible

See original GitHub issue

Hi there,

When using my own dataset (28x28, grayscale), I get an error for this line in

g_optim = tf.train.AdamOptimizer(config.learning_rate, beta1=config.beta1) \ .minimize(self.g_loss, var_list=self.g_vars)

error: Traceback (most recent call last): File "...tensorflow/python/framework/", line 575, in merge_with new_dims.append(dim.merge_with(other[i])) File "...tensorflow/python/framework/", line 133, in merge_with self.assert_is_compatible_with(other) File "...tensorflow/python/framework/", line 108, in assert_is_compatible_with % (self, other)) ValueError: Dimensions 4 and 3 are not compatible During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 74, in <module> File "...tensorflow/python/platform/", line 30, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) File "", line 59, in main dcgan.train(FLAGS) File "...DCGAN-tensorflow/", line 139, in train .minimize(self.g_loss, var_list=self.g_vars) File "...tensorflow/python/training/", line 196, in minimize grad_loss=grad_loss) File "...tensorflow/python/training/", line 253, in compute_gradients colocate_gradients_with_ops=colocate_gradients_with_ops) File "...tensorflow/python/ops/", line 491, in gradients in_grad.set_shape(t_in.get_shape()) File "...tensorflow/python/framework/", line 408, in set_shape self._shape = self._shape.merge_with(shape) File "...tensorflow/python/framework/", line 579, in merge_with (self, other)) ValueError: Shapes (64, 4, 4, 256) and (64, 3, 3, 256) are not compatible

Any advice on how to fix this?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

carpedm20commented, Jan 15, 2017

@hercky Oh I see. The problem was the size of input is too small for 4 layer networks and it’s not dividable. I think it’s tricky problem that a depth of network highly depends on input width, height and there is no one answer for it. I’ll just add a raise Exception code if the input size is “too small” for the current network design and suggest people to change it.

carpedm20commented, Jan 7, 2017

I’m not sure but the fast simple bypass might be adding tf.image.resize_images right after

self.images = tf.placeholder(tf.float32, 
                            [self.batch_size] + [self.output_size, self.output_size, self.c_dim],

is defined.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keras: Trying to model.predict() gives "ValueError: Tensor's ...
I'm following the TensorFlow Keras tutorial for text generation. ... ValueError: Tensor's shape (9, 64, 256) is not compatible with supplied ...
Read more > Build TensorFlow input pipelines
The API enables you to build complex input pipelines from simple, reusable pieces. For example, the pipeline for an image model might...
Read more >
CS231n Convolutional Neural Networks for Visual Recognition
We use three main types of layers to build ConvNet architectures: Convolutional Layer, Pooling Layer, and Fully-Connected Layer (exactly as seen in regular ......
Read more >
Multiclass semantic segmentation using DeepLabV3+ - Keras
Train Dataset: <BatchDataset shapes: ((4, 512, 512, 3), (4, 512, 512, 1)), ... conv1_conv (Conv2D) (None, 256, 256, 64) 9472 conv1_pad[0][0] ...
Read more >
Change input shape dimensions for fine-tuning with Keras
Figure 3: A subset of the Kaggle Dogs vs. Cats dataset is used for this Keras input shape example. Using a smaller dataset...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found