[2/N] Fix some violations of unused-function and unused-variable checks in torch_cpu (#129878)

Follows #128670

Pull Request resolved: https://github.com/pytorch/pytorch/pull/129878
Approved by: https://github.com/ezyang
This commit is contained in:
cyy
2024-07-04 00:39:28 +00:00
committed by PyTorch MergeBot
parent d95a019704
commit efb73eda51
23 changed files with 60 additions and 21 deletions

View File

@ -335,11 +335,13 @@ class class_ : public ::torch::detail::class_base {
// type validation
auto getstate_schema = classTypePtr->getMethod("__getstate__").getSchema();
#ifndef STRIP_ERROR_MESSAGES
auto format_getstate_schema = [&getstate_schema]() {
std::stringstream ss;
ss << getstate_schema;
return ss.str();
};
#endif
TORCH_CHECK(
getstate_schema.arguments().size() == 1,
"__getstate__ should take exactly one argument: self. Got: ",