One-hot encoding is 0/1-encoding (0 for negative and 1 for positive), likewise -1/+1 encoding. Replace 0’s with -1s. You will see this: Measures the loss given an input tensor xx and a labels tensor yy (containing 1 or -1) in the docs 3.