NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

void conv_forward(conv_layer_t* l, vol_t** in, vol_t** out, int start, int end) {

int l_out_depth = l->out_depth;
int xy_stride = l->stride;
int l_out_sy = l->out_sy;
int l_out_sx = l->out_sx;
for (int i = start; i <= end; i++) {

vol_t* V = in[i];
vol_t* A = out[i];
int V_sx = V->sx;
int V_sy = V->sy;
int V_depth = V->depth;
double* V_w = V->w;

for(int d = 0; d < l_out_depth; d++) {
vol_t* f = l->filters[d];
int y = -l->pad;

vol_t* l_biases = l->biases;
int f_sx = f->sx;
int f_sy = f->sy;
int f_depth = f->depth;
double* f_w = f->w;
int x = -l->pad;

for(int ax = 0; ax < l_out_sx; ax++) {
for(int ay = 0; ay < l_out_sy; ay++) {
double a = 0.0;
int ox = x + (ax*xy_stride);
int oy = y-1 + (xy_stride*ay);
//int lol = 0;
/*
if (oy < 0) {
lol = -oy;
printf("%dn", lol);
oy = -1;
}
*/
for(int fy = 0; fy < f_sy; fy++) {
oy++;
//int oy = y+fy;
if (oy >= 0 && oy < V_sy) {
double sum[4];
int f_3 = !(f_depth%3);
if(ox >= 0) {
double* initial_f = &f_w[((f_sx * fy))*f_depth];
double* initial_v = &V_w[((V_sx * oy)+ox)*V_depth];
if (f_3) a += initial_f[0] * initial_v[0] + initial_f[1] * initial_v[1] + initial_f[2] * initial_v[2];
else {

__m256d array = _mm256_setzero_pd();
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f), _mm256_loadu_pd(initial_v)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+4), _mm256_loadu_pd(initial_v+4));
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+8), _mm256_loadu_pd(initial_v+8)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+12), _mm256_loadu_pd(initial_v+12));
//a += f_w[((f_sx * fy))*f_depth+fd] * V_w[((V_sx * oy)+ox)*V_depth+fd] + f_w[((f_sx * fy))*f_depth+fd+1] * V_w[((V_sx * oy)+ox)*V_depth+fd+1];
//a += f_w[((f_sx * fy))*f_depth+fd+2] * V_w[((V_sx * oy)+ox)*V_depth+fd+2] + f_w[((f_sx * fy))*f_depth+fd+3] * V_w[((V_sx * oy)+ox)*V_depth+fd+3];
if (f_depth == 20) {
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+16), _mm256_loadu_pd(initial_v+16));
//a += f_w[((f_sx * fy))*f_depth+fd] * V_w[((V_sx * oy)+ox)*V_depth+fd] + f_w[((f_sx * fy))*f_depth+fd+1] * V_w[((V_sx * oy)+ox)*V_depth+fd+1];
//a += f_w[((f_sx * fy))*f_depth+fd+2] * V_w[((V_sx * oy)+ox)*V_depth+fd+2] + f_w[((f_sx * fy))*f_depth+fd+3] * V_w[((V_sx * oy)+ox)*V_depth+fd+3];
}

_mm256_storeu_pd(&sum[0], array);
a += sum[0] + sum[1] + sum[2] + sum[3];
}
}

//ox++;
if(++ox >= 0) {

double* initial_f = &f_w[((f_sx * fy)+1)*f_depth];
double* initial_v = &V_w[((V_sx * oy)+ox)*V_depth];
if (f_3) a += initial_f[0] * initial_v[0] + initial_f[1] * initial_v[1] + initial_f[2] * initial_v[2];
else {

__m256d array = _mm256_setzero_pd();
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f), _mm256_loadu_pd(initial_v)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+4), _mm256_loadu_pd(initial_v+4));
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+8), _mm256_loadu_pd(initial_v+8)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+12), _mm256_loadu_pd(initial_v+12));

if (f_depth == 20) {
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+16), _mm256_loadu_pd(initial_v+16));
}

_mm256_storeu_pd(&sum[0], array);
a += sum[0] + sum[1] + sum[2] + sum[3];
}
}

//ox++;


double* initial_f = &f_w[((f_sx * fy)+2)*f_depth];
double* initial_v = &V_w[((V_sx * oy)+(++ox))*V_depth];
if (f_3) a += initial_f[0] * initial_v[0] + initial_f[1] * initial_v[1] + initial_f[2] * initial_v[2];
else {

__m256d array = _mm256_setzero_pd();
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f), _mm256_loadu_pd(initial_v)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+4), _mm256_loadu_pd(initial_v+4));
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+8), _mm256_loadu_pd(initial_v+8)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+12), _mm256_loadu_pd(initial_v+12));

if (f_depth == 20) {
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+16), _mm256_loadu_pd(initial_v+16));
}

_mm256_storeu_pd(&sum[0], array);
a += sum[0] + sum[1] + sum[2] + sum[3];
}


//ox++;
if(++ox < V_sx) {

double* initial_f = &f_w[((f_sx * fy)+3)*f_depth];
double* initial_v = &V_w[((V_sx * oy)+ox)*V_depth];
if (f_3) a += initial_f[0] * initial_v[0] + initial_f[1] * initial_v[1] + initial_f[2] * initial_v[2];
else {

__m256d array = _mm256_setzero_pd();
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f), _mm256_loadu_pd(initial_v)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+4), _mm256_loadu_pd(initial_v+4));
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+8), _mm256_loadu_pd(initial_v+8)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+12), _mm256_loadu_pd(initial_v+12));

if (f_depth == 20) {
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+16), _mm256_loadu_pd(initial_v+16));
}

_mm256_storeu_pd(&sum[0], array);
a += sum[0] + sum[1] + sum[2] + sum[3];
}
}

//ox++;
if(++ox < V_sx) {

double* initial_f = &f_w[((f_sx * fy)+4)*f_depth];
double* initial_v = &V_w[((V_sx * oy)+ox)*V_depth];
if (f_3) a += initial_f[0] * initial_v[0] + initial_f[1] * initial_v[1] + initial_f[2] * initial_v[2];
else {

__m256d array = _mm256_setzero_pd();
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f), _mm256_loadu_pd(initial_v)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+4), _mm256_loadu_pd(initial_v+4));
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+8), _mm256_loadu_pd(initial_v+8)) + _mm256_mul_pd(_mm256_loadu_pd(initial_f+12), _mm256_loadu_pd(initial_v+12));

if (f_depth == 20) {
array += _mm256_mul_pd(_mm256_loadu_pd(initial_f+16), _mm256_loadu_pd(initial_v+16));
}

_mm256_storeu_pd(&sum[0], array);
a += sum[0] + sum[1] + sum[2] + sum[3];
}
}
ox -= 4;
}

}
a += l_biases->w[d];
set_vol(A, ax, ay, d, a);
}
}
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.