How can I add bias using pytorch to a neural network?
If I have this neural network (NN):

 class NeuralNet(nn.Module):
    def __init__(self, input_size, hidden_size, num_classes, p=dropout):
        super(NeuralNet, self).__init__()
        self.fc1 = nn.Linear(input_size, hidden_size)
        self.fc2 = nn.Linear(hidden_size, hidden_size)
        self.fc3 = nn.Linear(hidden_size, num_classes)
        self.dropout = nn.Dropout(p=p)

    def forward(self, x):
        out = F.relu(self.fc1(x))
        out = F.relu(  self.dropout(self.fc2(out)))
        out = self.fc3(out)
        return out


How do you add bias to it? For instance, on the hidden layer. I can't find anything online.

It depends on the layer you are using. Some do not have that option. In linear, for example, you can use:

self.fc1 = nn.Linear(input_size, hidden_size, bias =False) # Either true or false, the default is true.


In the documentation you can see for other types of layers if they have a bias option or not.
