commit 07f4e51797e825f53a8c9b284ab6e40eabbf0254
parent 2b640e4300d651bbceb4ca5d39729ee9b14e89b9
Author: David Freifeld <freifeld.david@gmail.com>
Date: Wed, 24 Jun 2020 18:08:46 -0700
Still working on switch
Diffstat:
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,6 +1,6 @@
all: mr_bpnn_2.cpp bpnn.cpp mapreduce.a
- g++ -w -O2 -Wall -shared -std=c++11 -undefined dynamic_lookup `python3 -m pybind11 --includes` mr_bpnn_2.cpp bpnn.cpp mapreduce.a -o mrbpnn`python3-config --extension-suffix`
+ g++ -w -O2 -Wall -shared -std=c++11 -undefined dynamic_lookup `python3 -m pybind11 --includes` mr_bpnn_2.cpp bpnn.cpp utils.cpp mapreduce.a -o mrbpnn`python3-config --extension-suffix`
clean:
$(RM) mrbpnn
diff --git a/bpnn.cpp b/bpnn.cpp
@@ -8,6 +8,7 @@ Layer::Layer(float* vals, int batch_sz, int nodes)
int datalen = batch_sz*nodes;
for (int i = 0; i < datalen; i++) {
(*contents)((int)i / nodes,i%nodes) = vals[i];
+ (*dZ)((int)i / nodes,i%nodes) = vals[i];
}
bias = new Eigen::MatrixXd (1, nodes);
for (int i = 0; i < nodes; i++) {
@@ -78,8 +79,15 @@ void Network::feedforward()
for (int j = 0; j < layers[i+1].contents->rows(); j++) {
// layers[i+1].contents->row(j) += *layers[i+1].bias; TODO ADD ME BACK!
}
- *layers[i+1].contents = (*layers[i+1]->activation)(*layers[i+1].contents);
- *layers[i+1].dZ = (*layers[i+1]->activate_deriv)(*layers[i+1].contents);
+ }
+ for (int i = 0; i < length; i++) {
+ for (int j = 0; j < layers[i].contents->rows(); j++) {
+ for (int k = 0; k < layers[i].contents->cols(); k++) {
+ std::cout << *layers[i].contents << "\n\n\n" << j << " " << k << " vs " << layers[i].contents->rows() << " " << layers[i].contents->cols() << "\n";
+ // (*layers[i].contents)(j,k) = 1;//(*layers[i].activation)((*layers[i].contents)(j,k));
+ //(*layers[i].dZ)(j,k) = 0;//(*layers[i].activation_deriv)((*layers[i].dZ)(j,k));
+ }
+ }
}
}
diff --git a/utils.cpp b/utils.cpp
@@ -68,8 +68,3 @@ int istreamtest () {
}
return 0;
}
-
-int main()
-{
- istreamtest();
-}