作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 python 3 和tensorflow 1.12 & eager eval
我正在尝试按照说明使用分散更新 here
我收到以下错误:
AttributeError: 'EagerTensor' object has no attribute '_lazy_read'
是否有解决方法或其他可用于急切评估的函数?
最佳答案
scatter_update需要变量而不是常数张量:
Applies sparse updates to a variable reference.
我猜你将一个常量张量传递给了scater_update
,导致抛出异常。以下是 eager-mode 的示例:
import tensorflow as tf
tf.enable_eager_execution()
data = tf.Variable([[2],
[3],
[4],
[5],
[6]])
cond = tf.where(tf.less(data, 5)) # update value less than 5
match_data = tf.gather_nd(data, cond)
square_data = tf.square(match_data) # square value less than 5
data = tf.scatter_nd_update(data, cond, square_data)
print(data)
# array([[ 4],
# [ 9],
# [16],
# [ 5],
# [ 6]], dtype=int32)>
关于python - 属性错误: object has no attribute '_lazy_read' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54399670/
已关闭。此问题需要 debugging details 。目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and the
我是一名优秀的程序员,十分优秀!