Okay, then this comes from the shape of your input. As it is torch.Size([6]) and not torch.Size([6, 1]), the model thinks it has an input shape of [features] instead of [batch_size].
Add x = x.unsqueeze(1) in your encoder() method. This will add a new dimension to your data, and make it clear to the model that it has an input of shape [batch_size, features].