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

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