It is recommended to use nn.Conv2D because it uses the nn.Module abstraction and nicely ties into the torch.optim framework well.


Yes, here’s an example of initializing the weights of a ConvNet via a custom weight initialization:
https://github.com/pytorch/examples/blob/c6bff8c51eee802be1a77575be0eb3eb5e211ada/dcgan/main.py#L89-L96,L131 337
https://github.com/pytorch/examples/blob/c6bff8c51eee802be1a77575be0eb3eb5e211ada/dcgan/main.py#L131 142