keras-dcgan icon indicating copy to clipboard operation
keras-dcgan copied to clipboard

Python error 'int' object has no attribute 'shape'

Open MritulaC opened this issue 2 years ago • 1 comments

I kept getting an error " Python error 'int' object has no attribute 'shape'" reflecting to the following line from def train in the dcgan.py file

g_loss = d_on_g.train_on_batch(noise, [1] * BATCH_SIZE))

Solution: Changing the line to the below worked well: g_loss = d_on_g.train_on_batch(noise,np.array([1] * BATCH_SIZE))

Correct me if this is wrong!

Hope this is of some help!

Thanks, Mritula

MritulaC avatar Jan 19 '22 05:01 MritulaC

yes, fixed issue on my machine, in same file line ‘d_loss = d.train_on_batch(X, y)’ need be modified to 'd_loss = d.train_on_batch(X, np.array(y))' as well. thx

Kang-Jack avatar Nov 07 '23 12:11 Kang-Jack