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

shape of data error? #46

Open
guili9300 opened this issue Apr 4, 2018 · 1 comment
Open

shape of data error? #46

guili9300 opened this issue Apr 4, 2018 · 1 comment

Comments

@guili9300
Copy link

Below is the alert that i got, anybody know y does this happen? Thank you

Traceback (most recent call last):
File "main.py", line 45, in
main(config)
File "main.py", line 37, in main
trainer.train()
File "D:\GAN study\BEGAN-tensorflow-master\trainer.py", line 161, in train
self.autoencode(x_fixed, self.model_dir, idx=step, x_fake=x_fake)
File "D:\GAN study\BEGAN-tensorflow-master\trainer.py", line 266, in autoencode
x = self.sess.run(self.AE_x, {self.x: img})
File "C:\Users\Josh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 895, in run
run_metadata_ptr)
File "C:\Users\Josh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1100, in _run
% (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (16, 3, 64, 64) for Tensor 'ToFloat:0', which has shape '(16, 64, 64, 3)'

@ndrsfel
Copy link

ndrsfel commented Apr 10, 2018

I have no idea why but this fixed it for me, just edit autoencode() in trainer.py

...
       for key, img in items.items():
            if img is None:
                continue
            if img.shape[3] in [1, 3]:
                img = img.transpose([0, 3, 1, 2])

            img = img.transpose([0, 2, 3, 1]) # add this
...

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