- Timestamp:
- Jan 8, 2019, 3:45:59 PM (6 years ago)
- Branches:
- feature/cnn_org, feature/crepe_org
- Children:
- eba2bc7a
- Parents:
- 3ffea61d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ai/conv1d.c
r3ffea61d rf217068 289 289 290 290 uint_t sdot_size = c->kernel->shape[0] * c->kernel->shape[1]; 291 uint_t input_stride = c->stride_shape * c-> kernel->shape[1];291 uint_t input_stride = c->stride_shape * c->padded_input->shape[1] 292 292 293 293 AUBIO_ASSERT(c && input_tensor && activations); … … 308 308 // for each output 309 309 for (j = 0; j < activations->shape[0]; j++) { 310 // for each row of activation output 311 aubio_cblas__gemv(CblasRowMajor, CblasTrans, 312 sdot_size, c->kernel->shape[2], 1., 313 c->kernel->buffer, c->kernel->shape[2], 314 c->padded_input->buffer + j * input_stride, 1, 0., 315 activations->buffer + j * activations->shape[1], 1); 316 } 317 for (j = 0; j < activations->shape[0]; j++) { 310 318 // for each kernel filter k 311 319 for (i = 0; i < activations->shape[1]; i++) { 312 // get bias 313 bias = c->bias->data[i]; 314 315 // compute one activation output 316 acc = aubio_cblas_dot(sdot_size, c->kernel->buffer + i, 317 c->kernel->shape[2], c->padded_input->buffer + j * input_stride, 1); 318 319 // apply bias 320 acc += bias; 321 322 // compute RELU 323 activations->data[j][i] = MAX(acc, 0.); 320 activations->data[j][i] += c->bias->data[i]; 321 activations->data[j][i] = MAX(activations->data[j][i], 0); 324 322 } 325 323 }
Note: See TracChangeset
for help on using the changeset viewer.