From db0397cfaaf488364e3d2e1669dfefae2ee6ea73 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Mon, 14 Dec 2015 19:57:10 +0000
Subject: [PATCH] shortcut layers, msr networks

---
 src/blas.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/blas.c b/src/blas.c
index 3785937..941109e 100644
--- a/src/blas.c
+++ b/src/blas.c
@@ -1,6 +1,22 @@
 #include "blas.h"
 #include "math.h"
 
+void shortcut_cpu(float *out, int w, int h, int c, int batch, int sample, float *add, int stride, int c2)
+{
+    int i,j,k,b;
+    for(b = 0; b < batch; ++b){
+        for(k = 0; k < c && k < c2; ++k){
+            for(j = 0; j < h/sample; ++j){
+                for(i = 0; i < w/sample; ++i){
+                    int out_index = i*sample + w*(j*sample + h*(k + c*b));
+                    int add_index = b*w*stride/sample*h*stride/sample*c2 + i*stride + w*stride/sample*(j*stride + h*stride/sample*k);
+                    out[out_index] += add[add_index];
+                }
+            }
+        }
+    }
+}
+
 void mean_cpu(float *x, int batch, int filters, int spatial, float *mean)
 {
     float scale = 1./(batch * spatial);

--
Gitblit v1.10.0