class SingleLayerPerceptron(nn.Module):
def __init__(self, input_size, output_size):
super(SingleLayerPerceptron, self).__init__()
self.fc = nn.Linear(input_size, output_size)
def forward(self, x):
return torch.sigmoid(self.fc(x)) # Using sigmoid for output activation
# Example usage:
slp = SingleLayerPerceptron(input_size=3, output_size=2)
example_input = torch.tensor([1.0, 2.0, 3.0])
print("SLP Output:", slp(example_input))