Since you are using a single output neuron for your binary classification task, torch.max(outputs, 1) will always yield zeros.
Instead you could use a threshold (e.g. 0, as you are dealing with logits) to calculate the error:
def error_criterion(outputs,labels):
    preds = outputs > 0.
    error = (preds.float() != labels).float().mean()
    return error

for t in range(900):
    outputs = net(x_data)
    
    loss = loss_fn(outputs, y_data)
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()


    if t % 100 == 0:
        print("Loss:", loss.item())
        print("Error:", error_criterion(outputs, y_data).item()) # I removed the squeeze() here

Also, note that you are basically using a single linear layer, since you don’t apply any activation function after layer1 and layer2.