标签: python-3.x tensorflow
我可以在Numpy中编写类似的代码,但我想知道如何在TensorFlow中做到这一点:
import numpy as np a = np.array([[0.2, 0.9], [0.1, 0.4]]) alpha = 0.6 output = a output[output <= alpha] = 0 output[output > alpha] = 1 print(output)