Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Virv12 committed Jan 30, 2024
1 parent 9811825 commit 1bc725f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC=g++ -std=c++17 -g -Ofast -Wall -Wextra -Iincludes -D_GLIBCXX_DEBUG -fsanitize=address
# CC=g++ -std=c++17 -Ofast -Wall -Wextra -Iincludes -DNDEBUG
# CC=clang++ -std=c++20 -g -Ofast -Wall -Wextra -Iincludes -D_GLIBCXX_DEBUG -fsanitize=address
CC=clang++ -std=c++20 -Ofast -Wall -Wextra -Wpedantic -Iincludes -DNDEBUG

DATASET=$(addprefix dataset/,t10k-labels-idx1-ubyte train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte)
BINARY=$(addprefix bin/,k-NN dnn tnn)
Expand Down
4 changes: 2 additions & 2 deletions includes/nn.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct LayerLinear : Layer {
float *W, *A;

LayerLinear(size_t I, size_t O);
~LayerLinear();
~LayerLinear() override;

LayerLinear(std::ifstream&);
virtual void save(std::ofstream&) override;
Expand Down Expand Up @@ -53,7 +53,7 @@ struct LayerConvolutional : Layer {
float *W, *A;

LayerConvolutional(size_t, size_t, std::array<size_t, 2>, std::array<size_t, 2>);
~LayerConvolutional();
~LayerConvolutional() override;

LayerConvolutional(std::ifstream&);
virtual void save(std::ofstream&) override;
Expand Down
2 changes: 2 additions & 0 deletions src/dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <fstream>
#include <array>
#include <vector>

#include <dataset.h>
using namespace std;

vector<uint8_t> train_labels;
Expand Down
11 changes: 5 additions & 6 deletions src/nn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
#include <vector>
#include <fstream>

// #include <nn.h>
#include "../includes/nn.h"
#include <nn.h>
using namespace std;

Layer* Layer::fromFile(int idx, ifstream& fin) {
switch (idx) {
case 0: puts("LayerLinear"); return new LayerLinear(fin);
case 1: puts("LayerSigmoid"); return new LayerSigmoid;
case 2: puts("LayerAveragePooling"); return new LayerAveragePooling(fin);
case 3: puts("LayerConvolutional"); return new LayerConvolutional(fin);
case 0: return new LayerLinear(fin);
case 1: return new LayerSigmoid;
case 2: return new LayerAveragePooling(fin);
case 3: return new LayerConvolutional(fin);
default: assert(false); return nullptr;
}
}
Expand Down

0 comments on commit 1bc725f

Please sign in to comment.