Summary:
Added the ">>>" python interpreter sign(three greater than symbols), so that the edited lines will appear as code, not comments/output, in the documentation. Normally, the interpreter would display "..." when expecting a block, but I'm not sure how this would work on the pytorch docs website. It seems that in other code examples the ">>>" sign is used as well, therefore I used with too.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19347
Differential Revision:
D14986154
Pulled By: soumith
fbshipit-source-id:
8f4d07d71ff7777b46c459837f350eb0a1f17e84
Example::
>>> def init_weights(m):
- print(m)
- if type(m) == nn.Linear:
- m.weight.data.fill_(1.0)
- print(m.weight)
-
+ >>> print(m)
+ >>> if type(m) == nn.Linear:
+ >>> m.weight.data.fill_(1.0)
+ >>> print(m.weight)
>>> net = nn.Sequential(nn.Linear(2, 2), nn.Linear(2, 2))
>>> net.apply(init_weights)
Linear(in_features=2, out_features=2, bias=True)