The example of the torch.nn.init.constant has a tiny problem in my view.
The nn.init.constant(w) lack a argument for the val.
thank you very much for reporting. We fixed this in master via commit https://github.com/pytorch/pytorch/commit/99068d2e52ab80bd7992c9f79d1d22042b29cf7c