Deep-Learning-Experiments icon indicating copy to clipboard operation
Deep-Learning-Experiments copied to clipboard

Is it necessary to use use a different class than the DCGAN class to build GAN

Open piyush01123 opened this issue 7 years ago • 0 comments

I was trying to implement https://github.com/roatienza/Deep-Learning-Experiments/blob/master/Experiments/Tensorflow/GAN/dcgan_mnist.py and it works fine. But I tried the exact same code without the wrapper class ie I wrote just one class DCGAN and tried to build D, G and AM in the same class through various functions. I came across very weird Keras errors like TypeError: __call__() missing 1 required positional argument: 'inputs' for the line https://github.com/roatienza/Deep-Learning-Experiments/blob/e501cc3d2f2d3bdb47303aa52edaab442577b0a1/Experiments/Tensorflow/GAN/dcgan_mnist.py#L133. Does this mean the Keras's Sequential object is stateful and changes usage based on whether it is used in the same class or different one?

Also, I noticed that there's a lot of duct-tape code like

 if self.D:
    return self.D

This pattern is repeated whenever you create a D/G/AM model. Why is this. Is this related to the other questions I raised?

piyush01123 avatar Feb 04 '19 16:02 piyush01123