mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Remove more unused variables in tests (#127510)
Follows #127379 Pull Request resolved: https://github.com/pytorch/pytorch/pull/127510 Approved by: https://github.com/Skylion007, https://github.com/r-barnes
This commit is contained in:
@ -51,9 +51,6 @@ endif()
|
||||
add_executable(test_api ${TORCH_API_TEST_SOURCES})
|
||||
target_include_directories(test_api PRIVATE ${ATen_CPU_INCLUDE})
|
||||
target_link_libraries(test_api PRIVATE torch gtest)
|
||||
if(NOT MSVC)
|
||||
target_compile_options_if_supported(test_api -Wno-unused-variable)
|
||||
endif()
|
||||
|
||||
if(USE_CUDA)
|
||||
target_compile_definitions(test_api PRIVATE "USE_CUDA")
|
||||
|
@ -806,7 +806,6 @@ TEST(SerializeTest, Optim_RMSprop) {
|
||||
for (const auto i : c10::irange(params1_2_.size())) {
|
||||
if (i != (params1_2_.size() - 1)) {
|
||||
auto key_ = params_[i].unsafeGetTensorImpl();
|
||||
auto key1_2_ = params1_2_[i].unsafeGetTensorImpl();
|
||||
const RMSpropParamState& curr_state_ =
|
||||
static_cast<const RMSpropParamState&>(*(optim1_state.at(key_).get()));
|
||||
RMSpropParamState& curr_state1_2_ =
|
||||
|
@ -1474,7 +1474,6 @@ TEST(LLVM, RFactorReduction) {
|
||||
TEST(LLVM, RFactorVectorizedReduction) {
|
||||
int M = 128;
|
||||
int N = 64;
|
||||
const int kTotalSize = M * N;
|
||||
|
||||
BufHandle a("a", {1, M, N}, kFloat);
|
||||
|
||||
|
@ -1092,6 +1092,7 @@ TEST(Reductions, ReduceOverSplitRfactor) {
|
||||
|
||||
// Check the IR to verify the rfactored reduce is eliminated.
|
||||
// TODO: The alloc free should be eliminated here since it is size 0.
|
||||
/*
|
||||
const std::string& verification_pattern =
|
||||
R"IR(
|
||||
# CHECK: Allocate(tmp_buf); // dtype=float, dims=[0]
|
||||
@ -1102,6 +1103,7 @@ TEST(Reductions, ReduceOverSplitRfactor) {
|
||||
# CHECK: }
|
||||
# CHECK: }
|
||||
# CHECK: Free(tmp_buf);)IR";
|
||||
*/
|
||||
// TODO: rfactor output is not consistent yet, will fix (@nickg).
|
||||
// torch::jit::testing::FileCheck().run(verification_pattern, oss.str());
|
||||
}
|
||||
|
@ -36,10 +36,8 @@ class StatefulDataLoader : public DataLoaderBase<
|
||||
|
||||
/// Constructs the `StatefulDataLoader` from a `dataset` and some `options`.
|
||||
StatefulDataLoader(Dataset dataset, DataLoaderOptions options)
|
||||
: super(
|
||||
std::move(options),
|
||||
std::make_unique<Dataset>(std::move(dataset))) {
|
||||
for (const auto w : c10::irange(this->options_.workers)) {
|
||||
: super(options, std::make_unique<Dataset>(std::move(dataset))) {
|
||||
for ([[maybe_unused]] const auto _ : c10::irange(this->options_.workers)) {
|
||||
// As opposed to the stateless case, here all worker threads access the
|
||||
// same underlying dataset.
|
||||
this->workers_.emplace_back(
|
||||
|
@ -541,9 +541,7 @@ struct slot_list_impl {
|
||||
size_t size() const {
|
||||
if (!size_) {
|
||||
size_ = size_t(0);
|
||||
// NOLINTNEXTLINE(clang-diagnostic-unused-variable)
|
||||
for (const value_type& s : *(this)) {
|
||||
(void)s; // Suppress unused variable warning
|
||||
for ([[maybe_unused]] const value_type& _ : *(this)) {
|
||||
++*size_;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user