I think this error is coming from your loss function - loss = loss_func(output, b_y) .
The size of output and b_y is different. BCEWithLogitsLoss() expects the input and output size to be the same. Check out the documentation here 206. Here’s a blog post 166 which goes through different loss functions in PyTorch.
The final fc2 layers gives out a tensor of size 2 while but your actual test input is of size 10.
What are you trying to solve with nnet? Binary classification?