Leeeeg
完蛋玩意儿
2021-02-27 23:02

请问各位大佬,这段代码一直报没有梯度错误是怎么回事哦(noise是(0,1)均匀分布随机数)?

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
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

为你推荐