小编use*_*638的帖子

AttributeError:“Adam”对象没有属性“get_updates”

我正在使用 TensorFlow Keras 后端训练 VAE,并使用 Adam 作为优化器。我使用的代码附在下面。

    def compile(self, learning_rate=0.0001):
    optimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate)
    self.model.compile(optimizer=optimizer,
                       loss=self._calculate_combined_loss,
                       metrics=[_calculate_reconstruction_loss,
                                calculate_kl_loss(self)])
Run Code Online (Sandbox Code Playgroud)

我使用的TensorFlow版本是2.11.0。我收到的错误是

AttributeError: 'Adam' object has no attribute 'get_updates'
Run Code Online (Sandbox Code Playgroud)

我怀疑问题是由于版本不匹配而出现的。有人可以帮我解决这个问题吗?提前致谢。

python tensorflow

2
推荐指数
1
解决办法
7891
查看次数

标签 统计

python ×1

tensorflow ×1