Solved by sethneel in post #2 
              
              
                Resolved: The sign was wrong in the absolute value portion of the code, the solution was switching them. 
        if torch.tensor(1.0/n)*torch.sum(predicted) > a:
            sign = 1
        else:
            sign = -1