求助各位大佬
GAN的generator定义如下,在训练时,选择了(0,1)区间的均匀分布随机数。一直报如下错
一开始以为是数据的问题,给数据都加上0.01以后还是报错实在不会改了 。。。
代码如下:
class Generator(Model):
def __init__(self):
super(Generator, self).__init__()
self.flatten = layers.Flatten()
self.dense1 = layers.Dense(64,activation='tanh')
self.dense4 = layers.Dense(784)
def call(self, noise, training=True):
fea = self.flatten(noise) # (100,28*28*1)
fea = self.dense1(fea) # 128 => 64
fea = self.dense4(fea) # 32 => 784
fea = tf.reshape(fea,shape=[-1,28,28,1])
return fea