Solved by ptrblck in post #2 
              
              
                You mean the view() op in in stn() and forward()? 
If you change the number of input channels, height and width for your input, you would need to adapt the in_features for the linear layers as well or alternatively use adaptive pooling layers to get your desired output size. 
As you can see self.loc…