The two scenarios when fully connected layers are equivalent to convolutional networks.
PyTorch-based code illustration here: https://github.com/rasbt/MachineLearning-QandAI-book/blob/main/supplementary/q12-fc-cnn-equivalence/q12-fc-cnn-equivalence.ipynb
