I am trying to build a simple 2 layer network, it has 2 inputs and 1 output, and the code is as follows:
num_input = 2
num_output = 1
# Input
x1 = torch.rand(1, 2)
# Weights
W1 = torch.rand(2,3)
W2 = torch.rand(3,1)
# biases
b1 = torch.rand(1,3)
b2 = torch.rand(1,1)
# Activation function
def f(inp):
inp[inp >= 0] = 1
inp[inp < 0] = 0
return inp
# Predict output
out = f(torch.mm(x1, W1) + b1)
y=W2*out +b2
print(y)
# Check solution
assert list(y.size()) == [1, num_output], f"Incorrect output size ({y.size()})"
print("nice!")
from this code I always get incorrect output size, can anyone give me a hint, how can I get the correct output size?

