The following issues were found
test/cpp/jit/test_alias_analysis.cpp
1 issues
Line: 160
std::unordered_map<std::string, Node*> nodes;
};
TEST_F(TopologicalMoveTest, SplitsDeps) {
// Check that we are removing `this`'s deps properly when we need to split
// `this` and deps (see code for what the hell that means)
EXPECT_TRUE(moveBeforeTopologicallyValid("q", "s"));
checkPostCondition("q", "s", false);
}
Reported by Cppcheck.
test/cpp/dist_autograd/test_dist_autograd.cpp
1 issues
Line: 32
DistAutogradContainer* DistAutogradTest::autogradContainer_ = nullptr;
TEST_F(DistAutogradTest, TestSendFunctionInvalidInputs) {
auto options = at::TensorOptions().requires_grad(true);
auto in1 = torch::ones({3, 3}, options);
auto in2 = torch::ones({3, 3}, options);
autogradContainer_->newContext();
Reported by Cppcheck.
test/cpp/api/modulelist.cpp
1 issues
Line: 203
Column: 20
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
ASSERT_EQ(first.get(), second.get());
ASSERT_EQ(first->size(), second->size());
ASSERT_TRUE(std::equal(
first->begin(),
first->end(),
second->begin(),
[](const std::shared_ptr<Module>& first,
const std::shared_ptr<Module>& second) {
Reported by FlawFinder.
test/cpp/api/nn_utils.cpp
1 issues
Line: 359
Column: 24
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
utils::vector_to_parameters(vec, model->parameters());
auto sample = model->parameters()[0][0][0][0];
ASSERT_TRUE(torch::equal(sample.data(), vec.data().slice(0, 0, 5)));
}
}
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers,cppcoreguidelines-avoid-non-const-global-variables)
int64_t PackedSequenceTest_batch_size = 5;
Reported by FlawFinder.
test/mobile/nnc/test_registry.cpp
1 issues
Line: 30
EXPECT_EQ(bar_kernel->execute(nullptr), 2);
}
TEST(MobileNNCRegistryTest, NoKernel) {
EXPECT_EQ(registry::has_nnc_kernel("missing"), false);
}
} // namespace nnc
} // namespace mobile
Reported by Cppcheck.
test/mobile/op_deps/simple_ops.cpp
1 issues
Line: 92
m.def("DD", TORCH_FN(DD_op));
}
TORCH_LIBRARY_FRAGMENT(_test, m) {
m.def("EE(Tensor self) -> Tensor");
m.def("FF(Tensor self) -> Tensor");
m.def("GG(Tensor self) -> Tensor");
m.def("HH(Tensor self) -> Tensor");
}
Reported by Cppcheck.
test/distributed/elastic/multiprocessing/bin/echo3.py
1 issues
Line: 1
Column: 1
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
Reported by Pylint.
test/distributed/elastic/multiprocessing/bin/test_script.py
1 issues
Line: 9
Column: 3
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# TODO <DELETE_ME>
Reported by Pylint.
test/distributed/elastic/multiprocessing/bin/zombie_test.py
1 issues
Line: 1
Column: 1
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import time
Reported by Pylint.
caffe2/utils/threadpool/WorkersPool.h
1 issues
Line: 38
Column: 9
CWE codes:
676
Suggestion:
Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient
void* p = nullptr;
#if defined(__ANDROID__)
p = memalign(kGEMMLOWPCacheLineSize, sizeof(T));
#elif defined(_MSC_VER)
p = _aligned_malloc(sizeof(T), kGEMMLOWPCacheLineSize);
#else
posix_memalign((void**)&p, kGEMMLOWPCacheLineSize, sizeof(T));
#endif
Reported by FlawFinder.