Skip to content
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

ValueError: Dimensions must be equal, but are 64 and 3 for 'Discriminator.1/Conv2D #15

Open
manyone opened this issue Jun 2, 2019 · 1 comment

Comments

@manyone
Copy link

manyone commented Jun 2, 2019

i've already built the tinyimages folder with the 64x64 images. earlier i had the error that conv2d etc can only handle NHWC so i recoded so it returns NHWC but im getting this error below and nothing shows up in my generated folder. i've already used python 3.5.6 (as suggested by a reply an earlier issue on the site). what do i do to get beyond this error?

whats interesting is - when i ran the program unchanged (except for the image locations), it produced one file in the generated folder, samples_groundtruth.png, before i got the "NHWC only" error.

(base) C:\apps\GANGogh-master>C:/Anaconda/python.exe c:/apps/GANGogh-master/GANgogh.py
Uppercase local vars:
BATCH_SIZE: 84
CLASSES: 14
CRITIC_ITERS: 5
DIM: 64
ITERS: 200000
LAMBDA: 10
MODE: acwgan
N_GPUS: 1
OUTPUT_DIM: 12288
PREITERATIONS: 2000
2019-06-02 01:51:34.101849: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
WARNING:tensorflow:From C:\Anaconda\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 1659, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 64 and 3 for 'Discriminator.1/Conv2D' (op: 'Conv2D') with input shapes: [84,3,64,64], [5,5,3,64].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:/apps/GANGogh-master/GANgogh.py", line 256, in
disc_fake,disc_fake_class = Discriminator(fake_data, CLASSES)
File "c:/apps/GANGogh-master/GANgogh.py", line 177, in kACGANDiscriminator
output = lib.ops.conv2d.Conv2D('Discriminator.1', 3, dim, 5, output, stride=2)
File "c:\apps\GANGogh-master\tflib\ops\conv2d.py", line 111, in Conv2D
data_format='NHWC'
File "C:\Anaconda\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1025, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "C:\Anaconda\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Anaconda\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 3300, in create_op
op_def=op_def)
File "C:\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 1823, in init
control_input_ops)
File "C:\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 1662, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 64 and 3 for 'Discriminator.1/Conv2D' (op: 'Conv2D') with input shapes: [84,3,64,64], [5,5,3,64].

(base) C:\apps\GANGogh-master>


@Nimisha-Pabbichetty
Copy link

Nimisha-Pabbichetty commented Nov 23, 2022

I know it's been a while but for others who run into this issue, this is because the code expects GPU implementation. Running it on CPU constantly gave me roadblocks in the form of errors such as this one. Once I ran it with tensorflow GPU set up, I stopped facing these errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants