In your current implementation, the in_channels are incorrectly defined.
Since the input image seems to have one channel, you should set in_channels=1:
nn.Conv2d(in_channels=1, out_channels=64, kernel_size=3, stride=1)

The same applies for all other conv layers. E.g. the second conv layer should have 64 input channels, since the first one returned this number of channels.
Another issue is that the spatial size of the activation does not change after each conv layer, which means that padding was used. For a kernel size of 3, you would have to use padding=1 to keep the same shape.
The classifier part of your model looks good. If you are dealing with a multi-class classification use case, you could just use nn.CrossEntropyLoss as the criterion and create the optimizer as was done in the Keras code.
I’m not sure, why Keras uses 7 output neurons.