From a723e1c62a27aeb39aaf7fcdeb3beb4e89fba32d Mon Sep 17 00:00:00 2001
From: Alexey <AlexeyAB@users.noreply.github.com>
Date: Wed, 15 Aug 2018 20:52:09 +0000
Subject: [PATCH] Merge pull request #766 from HotChick91/AlexeyAB-mask
---
src/network.c | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/src/network.c b/src/network.c
index 3df837d..2ad5141 100644
--- a/src/network.c
+++ b/src/network.c
@@ -222,7 +222,7 @@
{
#ifdef GPU
if (gpu_index >= 0) return get_network_output_gpu(net);
-#endif
+#endif
int i;
for(i = net.n-1; i > 0; --i) if(net.layers[i].type != COST) break;
return net.layers[i].output;
@@ -366,7 +366,7 @@
/*
layer *l = net->layers + i;
cudnn_convolutional_setup(l, cudnn_fastest);
- // check for excessive memory consumption
+ // check for excessive memory consumption
size_t free_byte;
size_t total_byte;
check_error(cudaMemGetInfo(&free_byte, &total_byte));
@@ -520,7 +520,7 @@
if(l.type == CONVOLUTIONAL){
prev = visualize_convolutional_layer(l, buff, prev);
}
- }
+ }
}
void top_predictions(network net, int k, int *index)
@@ -684,7 +684,7 @@
}
}
free(X);
- return pred;
+ return pred;
}
matrix network_predict_data(network net, data test)
@@ -707,7 +707,7 @@
}
}
free(X);
- return pred;
+ return pred;
}
void print_network(network net)
@@ -749,7 +749,7 @@
printf("%5d %5d\n%5d %5d\n", a, b, c, d);
float num = pow((abs(b - c) - 1.), 2.);
float den = b + c;
- printf("%f\n", num/den);
+ printf("%f\n", num/den);
}
float network_accuracy(network net, data d)
@@ -847,3 +847,26 @@
}
}
}
+
+
+
+void calculate_binary_weights(network net)
+{
+ int j;
+ for (j = 0; j < net.n; ++j) {
+ layer *l = &net.layers[j];
+
+ if (l->type == CONVOLUTIONAL) {
+ //printf(" Merges Convolutional-%d and batch_norm \n", j);
+
+ if (l->xnor) {
+ //printf("\n %d \n", j);
+ l->lda_align = 256; // 256bit for AVX2
+
+ binary_align_weights(l);
+ }
+ }
+ }
+ //printf("\n calculate_binary_weights Done! \n");
+
+}
\ No newline at end of file
--
Gitblit v1.10.0