I want to design a neural network in the form below:
Wx + kx + b
W is the neural network weight and And k is the weight of a fuzzy network, which ultimately combines this fuzzy network with the neural network.
Can I manipulate nn.Module to do this?
class Net(nn.Module):
def init(self, input_size, hidden_size, num_classes):
super(Net, self).init() # Inherited from the parent class nn.Module
self.fc1 = nn.Linear(input_size, hidden_size)
self.relu = nn.ReLU()
self.fc2 = nn.Linear(hidden_size, num_classes)
def forward(self, x): # Forward pass: stacking each layer together
out = self.fc1(x)
out = self.relu(out)
out = self.fc2(out)
return out