-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprofile_fnn_classification.cpp
More file actions
95 lines (82 loc) · 3.18 KB
/
profile_fnn_classification.cpp
File metadata and controls
95 lines (82 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/***************************************************************************
* profile_fnn_classification.cpp
*
* Copyright 2021 Mirco De Marchi
*
****************************************************************************/
/*
* This file is part of EdgeLearning.
*
* EdgeLearning is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EdgeLearning is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EdgeLearning. If not, see <https://www.gnu.org/licenses/>.
*/
#include "profile_fnn.hpp"
const NeuralNetworkDescriptor cifar_hidden_layers_descriptor(
{
Dense{"hidden_layer0", 20, ActivationType::ReLU },
Dense{"hidden_layer1", 10, ActivationType::ReLU },
}
);
const NeuralNetworkDescriptor mnist_hidden_layers_descriptor(
{
Dense{"hidden_layer0", 200, ActivationType::ReLU },
Dense{"hidden_layer1", 100, ActivationType::ReLU },
// Conv{"hidden_layer0", {32, {3,3}}, ActivationType::ReLU },
}
);
template <
OptimizerType OT,
ParallelizationLevel PL = ParallelizationLevel::SEQUENTIAL>
class ProfileFNNClassification : public ProfileFNN<LossType::CCE, OT, PL>
{
public:
ProfileFNNClassification(
ProfileDataset::Type dataset_type,
std::vector<NeuralNetworkDescriptor> hidden_layers_descriptor_vec,
ProfileNN::TrainingSetting default_setting)
: ProfileFNN<LossType::CCE, OT, PL>(
"classification",
dataset_type,
hidden_layers_descriptor_vec,
default_setting)
{ }
};
int main() {
SizeType EPOCHS = 1;
SizeType BATCH_SIZE = 64;
NumType LEARNING_RATE = 0.01;
ProfileFNNClassification<OptimizerType::GRADIENT_DESCENT>(
ProfileDataset::Type::MNIST,
{mnist_hidden_layers_descriptor},
{EPOCHS, BATCH_SIZE, LEARNING_RATE}).run();
ProfileFNNClassification<OptimizerType::ADAM>(
ProfileDataset::Type::MNIST,
{mnist_hidden_layers_descriptor},
{EPOCHS, BATCH_SIZE, LEARNING_RATE}).run();
ProfileFNNClassification<OptimizerType::GRADIENT_DESCENT>(
ProfileDataset::Type::CIFAR10,
{cifar_hidden_layers_descriptor},
{EPOCHS, BATCH_SIZE, LEARNING_RATE}).run();
ProfileFNNClassification<OptimizerType::ADAM>(
ProfileDataset::Type::CIFAR10,
{cifar_hidden_layers_descriptor},
{EPOCHS, BATCH_SIZE, LEARNING_RATE}).run();
ProfileFNNClassification<OptimizerType::GRADIENT_DESCENT>(
ProfileDataset::Type::CIFAR100,
{cifar_hidden_layers_descriptor},
{EPOCHS, BATCH_SIZE, LEARNING_RATE}).run();
ProfileFNNClassification<OptimizerType::ADAM>(
ProfileDataset::Type::CIFAR100,
{cifar_hidden_layers_descriptor},
{EPOCHS, BATCH_SIZE, LEARNING_RATE}).run();
}