If I understand correctly, you can just use the outputs from the forward pass without any modification, and then apply the sign funciton on the outptus:
output = model(x)
q = sign(output)

Also, another thing is that you don’t have to apply relu() and then sign(). relu() will convert the negative values to zero, and leave the positive values untouched. As a result, if you apply relu and sign together, your final outputs will only be 0 and 1 so you will miss the -1 in the output.