So I’ve tested your code, and there may be an error with your  nn.BatchNorm1d, I get a ValueError. I believe you should use nn.BatchNorm1d(1, affine=True) since you only have one channel after your linear layer.