Remove legacy constructor calls from pytorch codebase. (#54142)

Summary:
Follow up from https://github.com/pytorch/pytorch/issues/53889
Related to https://github.com/pytorch/pytorch/issues/47112

Removing every occurrence of the legacy constructor call present in PyTorch at:
- _docs_
- _benchmarks_
- _test_
- _caffe2_
- _CONTRIBUTING.md_

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

Reviewed By: ngimel

Differential Revision: D27699450

Pulled By: mruberry

fbshipit-source-id: 530aa3f5746cc8bc1407d5d51b2bbd8075e30546
This commit is contained in:
Yukio Siraichi
2021-04-11 15:43:54 -07:00
committed by Facebook GitHub Bot
parent fa29a647db
commit 93bf0ae6fc
40 changed files with 350 additions and 351 deletions

View File

@ -99,7 +99,7 @@ class TestTensorBoardPyTorchNumpy(BaseTestCase):
self.assertIsInstance(make_np(0.1), np.ndarray)
def test_pytorch_autograd_np(self):
x = torch.autograd.Variable(torch.Tensor(1))
x = torch.autograd.Variable(torch.empty(1))
self.assertIsInstance(make_np(x), np.ndarray)
def test_pytorch_write(self):
@ -289,8 +289,8 @@ class TestTensorBoardSummaryWriter(BaseTestCase):
class TestTensorBoardEmbedding(BaseTestCase):
def test_embedding(self):
w = self.createSummaryWriter()
all_features = torch.Tensor([[1, 2, 3], [5, 4, 1], [3, 7, 7]])
all_labels = torch.Tensor([33, 44, 55])
all_features = torch.tensor([[1., 2., 3.], [5., 4., 1.], [3., 7., 7.]])
all_labels = torch.tensor([33., 44., 55.])
all_images = torch.zeros(3, 3, 5, 5)
w.add_embedding(all_features,
@ -309,8 +309,8 @@ class TestTensorBoardEmbedding(BaseTestCase):
def test_embedding_64(self):
w = self.createSummaryWriter()
all_features = torch.Tensor([[1, 2, 3], [5, 4, 1], [3, 7, 7]])
all_labels = torch.Tensor([33, 44, 55])
all_features = torch.tensor([[1., 2., 3.], [5., 4., 1.], [3., 7., 7.]])
all_labels = torch.tensor([33., 44., 55.])
all_images = torch.zeros((3, 3, 5, 5), dtype=torch.float64)
w.add_embedding(all_features,