@acobobby You are correct but we have some special infrastructure to support torch.nn Modules without needing to trace them (see builtin functions 10 in the master docs for details), so just assigning them as submodules without tracing them is fine (e.g.
self.conv1 = nn.Conv2d(1, 20, 5)).
I don’t remember if these changes were put in an official release yet though, @XiaXuehai could you try to reproduce your issue on the PyTorch nightly build? Your code snippet runs fine for me on it.