Remove backward and requires_grad from Autograd backend key (#49613)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49613
Just following a TODO in the code base...
ghstack-source-id: 119450484
Test Plan: waitforsandcastle
Reviewed By: ezyang
Differential Revision: D25644597
fbshipit-source-id: 26f5fa6af480929d0468b0de3ab103813e40d78b
diff --git a/torch/csrc/autograd/VariableTypeManual.cpp b/torch/csrc/autograd/VariableTypeManual.cpp
index d1f15ff..f6c3f23 100644
--- a/torch/csrc/autograd/VariableTypeManual.cpp
+++ b/torch/csrc/autograd/VariableTypeManual.cpp
@@ -387,14 +387,6 @@
m.impl("detach", torch::dispatch(DispatchKey::Autograd, TORCH_FN(VariableType::detach)));
m.impl("detach_", torch::dispatch(DispatchKey::Autograd, TORCH_FN(VariableType::detach_)));
m.impl("copy_", torch::dispatch(DispatchKey::Autograd, TORCH_FN(VariableType::copy_)));
- // For backward() and requires_grad_(), we need the DefaultBackend kernel, but we also need the Autograd backend
- // kernel, because when called with a VariableTensorId tensor, it goes through the variable fallback kernel,
- // which calls callBoxed(), which doesn't support optional tensor arguments yet and backward() has an optional
- // tensor argument.
- // TODO Once callBoxed() supports optional tensor arguments, we can enable `use_c10_dispatcher: full` for backward()
- // and requires_grad_(), then remove the backend Autograd kernel here, only leaving the Math kernel.
- m.impl("_backward", torch::dispatch(DispatchKey::Autograd, TORCH_FN(VariableType::_backward)));
- m.impl("requires_grad_", torch::dispatch(DispatchKey::Autograd, TORCH_FN(VariableType::requires_grad_)));
m.impl("_fw_primal", torch::dispatch(DispatchKey::Autograd, TORCH_FN(VariableType::_fw_primal)));
}