【发布时间】:2021-04-03 13:48:50
【问题描述】:
对于 numpy,我们有
threshold = 3
a = np.array([1,2,3,4,5,6])
a[a>=3] = 199
# a is [1, 2, 199, 199, 199, 199]
如何在tensorflow 2写类似的代码
b = tf.Variable(a)
谢谢。
【问题讨论】:
标签: python python-3.x conditional-statements tensorflow2.0