What happened
The simulator reached aConv2d or Flatten layer and refused to run it. The frame was the wrong rank, the image size was missing, the kernel did not fit, or a dense layer received an image.
Why
Convolution needs a height and a width. The firstsnn.Conv2d stores them only when you pass input_height and input_width. A dense layer reads a vector, so a convolution has to be flattened first. The simulator does not guess either of these.
How to fix
- Construct the first convolution with
input_heightandinput_width, then recompile. - Put
snn.Flatten()between the last spatial map and the nextsnn.Dense. - If the kernel is larger than the frame, use the padding that makes the same
torch.nn.Conv2drun.