Strictly speaking, this is not an error – but a warning instead. It tells you that nn.functional.sigmoid is deprecated, meaning that it is no longer supported by the current PyTorch API, and that it may be removed in the future.
It was deprecated because “tensors and variables are now merged” – per one of the PyTorch developers.
So far, it still works, but you might best replace it with nn.Sigmoid instead, like this:
self.layers = nn.Sequential(
nn.Linear(28 * 28, 256),