Could you check the shape of your input tensor?
Your model is working fine for the expected input shape of [batch_size, 2048]:
mlp1 = MLP1()
x = torch.randn(8, 2048)
out = mlp1(x)
print(out.shape)
> torch.Size([8, 512])

PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier. I’ve formatted your code so that I could copy-paste it.