File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77cmake ..
88make
99./src/tensor_sann_main
10+ ./src/tensor_sann_model_main
Original file line number Diff line number Diff line change @@ -19,19 +19,19 @@ class NeuralNetwork{
1919
2020 void set_loss_func (std::shared_ptr<LossFunction> lossfunc);
2121
22- Tensor forward ();
22+ // Tensor forward();
2323
24- Tensor backward ();
24+ // Tensor backward();
2525
26- void train ();
26+ // void train();
2727
28- float validate ();
28+ // float validate();
2929
3030
3131protected:
32- std::vector<Layer> layers ;
33- std::shared_ptr<LossFunction> lossFunction ; // Loss function
34- std::shared_ptr<Optimizer> optimizer ;
32+ std::vector<Layer> layers_ ;
33+ std::shared_ptr<LossFunction> lossFunction_ ; // Loss function
34+ std::shared_ptr<Optimizer> optimizer_ ;
3535
3636};
3737
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace TensorSANN{
99class Optimizer {
1010public:
1111 virtual ~Optimizer () = default ;
12- virtual bool update (Layer & layer);
12+ virtual bool update (Layer & layer) = 0 ;
1313};
1414
1515}// namespace TensorSANN
Original file line number Diff line number Diff line change @@ -10,8 +10,7 @@ namespace TensorSANN{
1010// class SGD {
1111class SGD : Optimizer{
1212public:
13- ~SGD () = default ;
14-
13+
1514 SGD (float learning_rate);
1615
1716 bool update (Layer & layer);
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ add_subdirectory(optimizers)
99
1010# Main executable that links all libraries
1111add_executable (tensor_sann_main main.cpp )
12+ add_executable (tensor_sann_model_main model_main.cpp )
1213
1314target_link_libraries (tensor_sann_main
1415 activations
@@ -18,3 +19,12 @@ target_link_libraries(tensor_sann_main
1819 optimizers
1920 # loss
2021)
22+
23+ target_link_libraries (tensor_sann_model_main
24+ activations
25+ core
26+ layers
27+ utils
28+ optimizers
29+ # loss
30+ )
Original file line number Diff line number Diff line change 11add_library (activations STATIC
22 ReLU.cpp
3+ Softmax.cpp
34)
45
56# Include the directory for headers
Original file line number Diff line number Diff line change 1+ #include " TensorSANN/core/NeuralNetwork.hpp"
2+ #include " TensorSANN/layers/Layer.hpp"
3+
4+
5+ namespace TensorSANN {
6+
7+ void NeuralNetwork::add_layer (Layer &layer){
8+ // layers_.push_back(layer); TODO this is borken
9+ }
10+
11+ void NeuralNetwork::set_optimzer (std::shared_ptr<Optimizer> optimzer){
12+ optimizer_ = optimzer;
13+
14+ }
15+
16+ void NeuralNetwork::set_loss_func (std::shared_ptr<LossFunction> lossfunc){
17+ lossFunction_ = lossfunc;
18+ }
19+
20+ }
Original file line number Diff line number Diff line change 77
88int main () {
99 std::cout << " Hello world!" << std::endl;
10- // TensorSANN::SGD optimizer = TensorSANN::SGD(0.01f);
10+ TensorSANN::SGD optimizer = TensorSANN::SGD (0 .01f );
1111
1212 std::vector<size_t > shape1 = {2 , 3 }; // 2x3 tensor
1313 TensorSANN::Tensor tensor_1 (shape1);
You can’t perform that action at this time.
0 commit comments