From 1f2155b8864031d1f434aa910ceaf53477217c75 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Fri, 10 Aug 2018 23:49:55 +0000
Subject: [PATCH] Experiments

---
 src/convolutional_layer.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/convolutional_layer.c b/src/convolutional_layer.c
index 7dc7dd2..d236ec2 100644
--- a/src/convolutional_layer.c
+++ b/src/convolutional_layer.c
@@ -44,7 +44,7 @@
         }
         mean = mean / size;
         for(i = 0; i < size; ++i){
-            binary[f*size + i] = (weights[f*size + i] > 0) ? mean : -mean;
+            binary[f*size + i] = (weights[f*size + i] > 0) ? mean: -mean;
         }
     }
 }
@@ -688,7 +688,8 @@
         //    t_input = calloc(t_intput_size, sizeof(float));
         //    im2col_cpu_custom_transpose(state.input, l.c, l.h, l.w, l.size, l.stride, l.pad, t_input, new_ldb);
         //}
-        //else
+        if (l.xnor && l.size == 3 && l.stride == 1 && l.pad == 1) {}
+        else
             im2col_cpu_custom(state.input, l.c, l.h, l.w, l.size, l.stride, l.pad, b);
 
 
@@ -771,13 +772,18 @@
                 }
                 */
 
-                /*
-                if (l.size == 3 && l.stride == 1 && l.pad == 1) {
+
+                if (l.size == 3 && l.stride == 1 && l.pad == 1)
+                {
+                    //binarize_weights(l.weights, l.n, l.c*l.size*l.size, l.binary_weights);
+                    //printf("\n mean = %f \n", l.mean_arr[0]);
+
                     convolution_2d(l.w, l.h, l.size, l.n, l.c, l.pad, l.stride,
-                        l.weights, state.input, l.output);
+                        //l.weights, state.input, l.output, l.mean_arr);
+                        l.binary_weights, state.input, l.output, l.mean_arr);
                 }
                 else {
-                */
+
                     //size_t ldb_align = 256; // 256 bit for AVX2
                     int ldb_align = l.lda_align;
                     size_t new_ldb = k + (ldb_align - k%ldb_align);
@@ -790,7 +796,7 @@
 
                     //free(t_input);
                     free(t_bit_input);
-                //}
+                }
 
             }
 

--
Gitblit v1.10.0