tensor=tf.constant([[12,-2],[-5,4]])
tensor=tf.cast(tensor>=0,tf.int32)
print(tensor)
tf.Tensor(
[[1 0]
[0 1]], shape=(2, 2), dtype=int32)
tensor=torch.tensor([0,10,0,12])
(tensor>0).type(torch.int32)
tensor([0, 1, 0, 1], dtype=torch.int32)
tensor.gt(0).to(torch.int32)
tensor([0, 1, 0, 1], dtype=torch.int32)