refactor: address cppcheck performance warnings and enable performance static analysis

This commit is contained in:
AI-anonymous
2026-05-20 00:24:55 +02:00
parent 3b15770437
commit 3c6dc29f5a
4 changed files with 12 additions and 16 deletions

View File

@@ -13,10 +13,9 @@
struct RegressionNet : torch::nn::Module {
torch::nn::Linear fc1{nullptr}, fc2{nullptr};
RegressionNet() {
fc1 = register_module("fc1", torch::nn::Linear(1, 16));
fc2 = register_module("fc2", torch::nn::Linear(16, 1));
}
RegressionNet()
: fc1(register_module("fc1", torch::nn::Linear(1, 16))),
fc2(register_module("fc2", torch::nn::Linear(16, 1))) {}
torch::Tensor forward(torch::Tensor x) {
x = torch::tanh(fc1->forward(x));