refactor: address cppcheck performance warnings and enable performance static analysis
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user