Revert "Deprecate legacy constructor torch.Tensor() (#54414)" (#55831)

Summary:
This PR reverts https://github.com/pytorch/pytorch/pull/54414 because of https://github.com/pytorch/pytorch/issues/55780

cc ysiraichi

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

Reviewed By: agolynski

Differential Revision: D27762264

Pulled By: heitorschueroff

fbshipit-source-id: 8079a660cc440cafb9d22aa031d36dde121e13b3
This commit is contained in:
Heitor Schueroff 2021-04-15 14:04:50 -07:00 committed by Facebook GitHub Bot
parent b940516061
commit 33159b68a3
2 changed files with 0 additions and 10 deletions

View File

@ -176,11 +176,6 @@ Tensor class reference
- To create a tensor with similar type but different size as another tensor,
use ``tensor.new_*`` creation ops.
.. warning::
The :class:`torch.Tensor` constructor is deprecated. Instead, consider using:
:func:`torch.tensor` for creating tensors from tensor-like objects (e.g. lists and tuples);
or :func:`torch.empty` for creating uninitialized tensors with specific sizes (e.g. int).
.. autoattribute:: Tensor.T
.. autosummary::

View File

@ -473,11 +473,6 @@ Tensor legacy_tensor_ctor(c10::DispatchKey dispatch_key, at::ScalarType scalar_t
return legacy_sparse_tensor_ctor(dispatch_key, scalar_type, args, kwargs);
}
TORCH_WARN_ONCE(
"Legacy tensor constructor is deprecated. "
"Use: torch.tensor(...) for creating tensors from tensor-like objects; "
"or torch.empty(...) for creating an uninitialized tensor with specific sizes.");
ParsedArgs<2> parsed_args;
auto r = parser.parse(args, kwargs, parsed_args);
if (r.idx == 0) {