pytorch variable out[out > 0] = 1 Posted on 2018-08-Sat In 长文 Views: Views: 12345# out[out > 0] = 1# out[out <= 0] = -1out = (out >= 0.5).float()# map 1,0 to 1,-1out = out * 2 - 1