[caffe2][autograd] Avoid extensive -Wunused-variable warnings on _any_requires_grad (#49167)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49167
Building with clang and a fair warning level can result in hundreds of lines of compiler output of the form:
```
caffe2\gen_aten_libtorch\autograd\generated\VariableType_1.cpp(2279,8): warning: unused variable '_any_requires_grad' [-Wunused-variable]
auto _any_requires_grad = compute_requires_grad( self );
^
caffe2\gen_aten_libtorch\autograd\generated\VariableType_1.cpp(2461,8): warning: unused variable '_any_requires_grad' [-Wunused-variable]
auto _any_requires_grad = compute_requires_grad( grad_output, self );
^
caffe2\gen_aten_libtorch\autograd\generated\VariableType_1.cpp(2677,8): warning: unused variable '_any_requires_grad' [-Wunused-variable]
auto _any_requires_grad = compute_requires_grad( self );
^
...
```
This happens when requires_derivative == False. Let's mark `_any_requires_grad` as potentially unused. If this were C++17 we would use `[[maybe_unused]]` but to retain compatibility with C++11 we just mark it with `(void)`.
Test Plan: CI + locally built
Reviewed By: ezyang
Differential Revision: D25421548
fbshipit-source-id: c56279a184b1c616e8717a19ee8fad60f36f37d1