Regarding to torch.set_default_tensor_type API, I know this API has been deprecated since PyTorch 2.1 according to torch.set_default_tensor_type — PyTorch 2.3 documentation, however it is still available in latest PyTorch 2.3 drop and can be used. May I know if there is a plan when this deprecated API will be totally removed from any version of PyTorch release?
The common guideline is to remove deprecated functions after ~2 minor releases. However, Variable
s are deprecated since PyTorch 0.4
and are still around in 2.4.0.dev20240506
:
import torch
a = torch.autograd.Variable(torch.randn(1), requires_grad=True)
b = a * 2
b.backward()
print(a.grad)
# tensor([2.])
With that being said, you should plan on updating your code after 2 minor releases.
Thanks for the comments.
Is there any particular reason that this API has been deprecated in 2.1 but still kept in 2.3 and seems no solid plan when it will be totally removed? Like for instance, is the perf impact discussed in set_default_device/torch.device has performance impact for non-factory functions · Issue #92701 · pytorch/pytorch (github.com) be one of the possible reason?