KERAS-Instructions for updating: colocations automatically handled by placer 自动处理

KERAS-Instructions for updating: Colocations handled automatically by placer

我正在使用 Keras 库解决我的神经网络错误。在使用 Dropout 时,我收到了 3 个以下警告

WARNING:tensorflow: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer.

WARNING:tensorflow: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`. 

WARNING:tensorflow: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead.

这是我如何在模型中使用 dropout

model.add(Dropout(rate=0.2))

虽然是警告,但我很担心。以前,当我像下面这样使用 dropout 时,我得到了另一个警告

model.add(Dropout(0.2))

我应该怎么做才能摆脱这些警告?谁能帮帮我

您无法真正摆脱这些警告,它们不是从您的代码生成的,而是从调用 tf.nn.dropout 的内部 keras 代码生成的。这些警告不是给你的,而是给 keras 团队的,他们必须更新 tensorflow 后端以删除警告。

消除警告的唯一方法是编辑 keras 的源代码。