【发布时间】:2018-05-20 15:01:18
【问题描述】:
我用numpy中的例子来介绍一下问题:
arr - some numpy array
a, b - constants
arr[arr < a] = b
现在,我想实现相同的功能,但在 Tensorflow 中,arr 将是一个张量。运行前张量值未知。
如您所见,答案将澄清为张量内的特定位置分配值,以及对张量执行条件化并检索满足条件的索引。
【问题讨论】:
-
非常类似于this question
-
见
tf.where:tensorflow.org/api_docs/python/tf/where
标签: python numpy tensorflow