The following issues were found
aten/src/ATen/core/interned_strings.cpp
1 issues
Line: 82
Column: 49
CWE codes:
126
Symbol sym(sym_to_info_.size());
string_to_sym_[s] = sym;
sym_to_info_.push_back({ns, s, s.substr(pos + strlen("::"))});
return sym;
}
std::pair<const char*, const char*> InternedStrings::customString(Symbol sym) {
std::lock_guard<std::mutex> guard(mutex_);
Reported by FlawFinder.
aten/src/ATen/core/dispatch/backend_fallback_test.cpp
1 issues
Line: 84
}
#ifndef ATEN_CPU_STATIC_DISPATCH
TEST(BackendFallbackTest, TestBackendFallbackWithMode) {
auto m = MAKE_TORCH_LIBRARY_IMPL(_, TESTING_ONLY_GenericMode);
m.fallback(torch::CppFunction::makeFromBoxedFunction<&generic_mode_fallback>());
c10::impl::IncludeDispatchKeyGuard guard(DispatchKey::TESTING_ONLY_GenericMode);
Reported by Cppcheck.
aten/src/ATen/core/dispatch/CppSignature_test.cpp
1 issues
Line: 14
EXPECT_EQ(CppSignature::make<int64_t(std::string, int64_t)>(), CppSignature::make<int64_t(std::string, int64_t)>());
}
TEST(CppSignatureTest, given_differentSignature_then_areDifferent) {
EXPECT_NE(CppSignature::make<void()>(), CppSignature::make<int64_t()>());
EXPECT_NE(CppSignature::make<int64_t(std::string)>(), CppSignature::make<int64_t(std::string, int64_t)>());
EXPECT_NE(CppSignature::make<std::string(std::string)>(), CppSignature::make<int64_t(std::string)>());
}
Reported by Cppcheck.
aten/src/ATen/core/boxing/impl/make_boxed_from_unboxed_functor_test.cpp
1 issues
Line: 65
EXPECT_EQ(4, result[0].toInt());
}
TEST(OperatorRegistrationTest_FunctorBasedKernel, givenKernel_whenRegistered_thenCanBeCalled) {
auto registrar = RegisterOperators().op("_test::my_op(Tensor dummy, int input) -> int", RegisterOperators::options().kernel<IncrementKernel>(DispatchKey::CPU));
expectCallsIncrement(DispatchKey::CPU);
}
TEST(OperatorRegistrationTest_FunctorBasedKernel, givenMultipleOperatorsAndKernels_whenRegisteredInOneRegistrar_thenCallsRightKernel) {
Reported by Cppcheck.
aten/src/ATen/core/boxing/impl/kernel_stackbased_test.cpp
1 issues
Line: 81
EXPECT_EQ(4, result[0].toInt());
}
TEST(OperatorRegistrationTest_StackBasedKernel, givenKernel_whenRegistered_thenCanBeCalled) {
auto registrar = RegisterOperators().op("_test::my_op(Tensor dummy, int input) -> int", RegisterOperators::options().kernel<&incrementKernel>(DispatchKey::CPU));
expectCallsIncrement(DispatchKey::CPU);
}
TEST(OperatorRegistrationTest_StackBasedKernel, givenMultipleOperatorsAndKernels_whenRegisteredInOneRegistrar_thenCallsRightKernel) {
Reported by Cppcheck.
aten/src/ATen/core/boxing/impl/kernel_lambda_test.cpp
1 issues
Line: 45
EXPECT_EQ(4, result[0].toInt());
}
TEST(OperatorRegistrationTest_LambdaBasedKernel, givenKernel_whenRegistered_thenCanBeCalled) {
auto registrar = RegisterOperators().op("_test::my_op(Tensor dummy, int input) -> int", RegisterOperators::options().kernel(DispatchKey::CPU, [] (Tensor, int64_t i) {return i+1;}));
expectCallsIncrement(DispatchKey::CPU);
}
TEST(OperatorRegistrationTest_LambdaBasedKernel, givenOutOfLineKernel_whenRegistered_thenCanBeCalled) {
Reported by Cppcheck.
aten/src/ATen/core/boxing/impl/kernel_lambda_legacy_test.cpp
1 issues
Line: 44
EXPECT_EQ(6, result[0].toInt());
}
TEST(OperatorRegistrationTest_LegacyLambdaBasedKernel, givenKernel_whenRegistered_thenCanBeCalled) {
auto registrar = RegisterOperators().op("_test::my_op(Tensor dummy, int input) -> int", [] (const Tensor& tensor, int64_t input) -> int64_t {
return input + 1;
});
expectCallsIncrement(DispatchKey::CPU);
}
Reported by Cppcheck.
aten/src/ATen/core/boxing/impl/kernel_function_test.cpp
1 issues
Line: 58
EXPECT_EQ(4, result[0].toInt());
}
TEST(OperatorRegistrationTest_FunctionBasedKernel, givenKernel_whenRegistered_thenCanBeCalled) {
auto registrar = RegisterOperators().op("_test::my_op(Tensor dummy, int input) -> int", RegisterOperators::options().kernel<decltype(incrementKernel), &incrementKernel>(DispatchKey::CPU));
expectCallsIncrement(DispatchKey::CPU);
}
TEST(OperatorRegistrationTest_FunctionBasedKernel, givenKernel_whenRegisteredWithTorchLibraryAndTorchFn_thenCanBeCalled) {
Reported by Cppcheck.
aten/src/ATen/core/boxing/impl/kernel_function_legacy_test.cpp
1 issues
Line: 69
EXPECT_EQ(4, result[0].toInt());
}
TEST(OperatorRegistrationTest_LegacyFunctionBasedKernel, givenKernel_whenRegistered_thenCanBeCalled) {
auto registrar = RegisterOperators().op("_test::my_op(Tensor dummy, int input) -> int", &incrementKernel);
expectCallsIncrement(DispatchKey::CPU);
}
TEST(OperatorRegistrationTest_LegacyFunctionBasedKernel, givenKernel_whenRegisteredInConstructor_thenCanBeCalled) {
Reported by Cppcheck.
aten/src/ATen/core/boxing/KernelFunction_test.cpp
1 issues
Line: 387
// functional, boxed calling
TEST(KernelFunctionTest, givenBoxedFunction_withReturn_whenCallingBoxed_thenWorks) {
KernelFunction func = KernelFunction::makeFromBoxedFunction<&kernels::boxed_func_with_return>();
kernels::expectBoxedCallingWithReturnWorks(func);
}
TEST(KernelFunctionTest, givenBoxedFunction_withoutReturn_whenCallingBoxed_thenWorks) {
Reported by Cppcheck.