【问题标题】:About tf.gradients is not supported when eager execution is enabled in R在 R 中启用急切执行时,不支持关于 tf.gradients
【发布时间】:2021-05-18 17:27:27
【问题描述】:

我正在尝试在 R 中实现 Grad-cam。我遇到了这个错误:

Error in py_call_impl(callable, dots$args, dots$keywords) : RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.

我在网上找到了一些解决方案,但它们都使用 python。我想知道我们如何在 R 版本的 keras 中解决这个问题。谢谢。

【问题讨论】:

    标签: r tensorflow keras


    【解决方案1】:

    这会有所帮助

    tf$compat$v1$disable_eager_execution()
    

    【讨论】:

    • 虽然此代码可能会回答问题,但提供有关它如何和/或为什么解决问题的额外上下文将提高​​答案的长期价值。
    猜你喜欢
    • 1970-01-01
    • 2019-08-29
    • 2020-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-17
    • 1970-01-01
    相关资源
    最近更新 更多