The error is raised because the spatial size of out and x2 doesn’t match and you thus cannot add these tensors together.
You could remove the pooling operation of out, which I think is creating the issue.