tensor operation
Suppose the value greater than 0.5 is set to 1, and the value less than 0.5 is set to 0.
for example,Tensor[0.1,0.2,0.8,0.9] --> Tensor[0,0,1,1].
I do not want to use for loop
so is there a corresponding function for the above operation?
tensor[tensor<0.5] = 0
tensor[tensor>=0.5] = 1
1 Like
Thank you very much!