[2/N] Fix clang-tidy warnings in torch/csrc/autograd (#133295)

Follows #133180
Pull Request resolved: https://github.com/pytorch/pytorch/pull/133295
Approved by: https://github.com/Skylion007
This commit is contained in:
cyy
2024-08-13 13:23:46 +00:00
committed by PyTorch MergeBot
parent 7756175273
commit e0a5536cc9
33 changed files with 62 additions and 148 deletions

View File

@ -3,8 +3,7 @@
// TODO: we may be able to move some imports from input_metadata.h to here, but
// it seems that function.h transitively depends on some of them.
namespace torch {
namespace autograd {
namespace torch::autograd {
namespace {
@ -158,7 +157,6 @@ std::stringstream InputMetadata::incompatible_shape_error_message(
}
bool InputMetadata::is_cpp_nested_tensor() const {
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
bool ret = std::holds_alternative<at::Tensor>(shape_);
TORCH_INTERNAL_ASSERT(ret == (is_nested_ && !is_tensor_subclass_))
return ret;
@ -203,5 +201,4 @@ bool InputMetadata::maybe_expandable_to(const at::Tensor& grad) const {
}
}
} // namespace autograd
} // namespace torch
} // namespace torch::autograd