Merge Variable and Tensor classes (#5225)

This replaces the torch.Tensor constructors with factories that produce
Variables. Similarly, functions on the torch module (e.g. torch.randn)
now return Variables.

To keep the PR to a reasonable size, I've left most of the unused tensor
code. Subsequent PRs will remove the dead code, clean-up calls to
torch.autograd.Variable, and rename Variable to Tensor everywhere.

There are some breaking changes because Variable and Tensors had
slightly different semantics. There's a list of those changes here:

 https://github.com/pytorch/pytorch/wiki/Breaking-Changes-from-Variable-and-Tensor-merge
This commit is contained in:
Sam Gross
2018-02-23 18:03:31 -05:00
committed by GitHub
parent 7a36c132ce
commit 30ec06c140
85 changed files with 1269 additions and 1004 deletions

View File

@ -24,8 +24,9 @@ def manual_seed(seed):
`torch._C.Generator` object.
Args:
seed (int or long): The desired seed.
seed (int): The desired seed.
"""
seed = int(seed)
import torch.cuda
if not torch.cuda._in_bad_fork: