Im not sure this will work, but could you please try:
with torch.no_grad():
    out = out * out
out = self.fc2(out)


Let me know if this solves your problem. In principle the operations realized under torch.no_grad() do not compute  gradients