I have a tensor with values between -1 and 1 . How can I get a new tensor such that where were negative values now there will be one and where were positive numbers now there will be 1? (efficiently)
Namely,
tensor1 = [-0.1, 0.5, 0.08]
new_tensor = [-1, 1, 1]
and zero will be -1 or 1