[docs] Remove .data from some docs (#65358)

Summary:
Related to https://github.com/pytorch/pytorch/issues/30987. Fix the following task:

- [ ] Remove the use of `.data` in all our internal code:
  - [ ] ...
  - [x] `docs/source/scripts/build_activation_images.py` and `docs/source/notes/extending.rst`

In `docs/source/scripts/build_activation_images.py`, I used `nn.init` because the snippet already assumes `nn` is available (the class inherits from `nn.Module`).

cc albanD

Pull Request resolved: https://github.com/pytorch/pytorch/pull/65358

Reviewed By: malfet

Differential Revision: D31061790

Pulled By: albanD

fbshipit-source-id: be936c2035f0bdd49986351026fe3e932a5b4032
This commit is contained in:
Rodrigo Berriel
2021-09-21 05:59:47 -07:00
committed by Facebook GitHub Bot
parent daa50f1e9f
commit f0ada4bd54
2 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ def plot_function(function, **args):
xrange = torch.arange(-7.0, 7.0, 0.01) # We need to go beyond 6 for ReLU6
pylab.plot(
xrange.numpy(),
function(torch.autograd.Variable(xrange)).data.numpy(),
function(xrange).detach().numpy(),
**args
)