- Timestamp:
- Dec 29, 2021, 5:51:45 PM (3 years ago)
- Branches:
- feature/cnn, feature/crepe
- Children:
- a5199ad
- Parents:
- 6ad67a5
- git-author:
- Paul Brossier <piem@piem.org> (01/01/19 19:20:51)
- git-committer:
- Paul Brossier <piem@piem.org> (12/29/21 17:51:45)
- Location:
- src/ai
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ai/tensor.c
r6ad67a5 r83ec87f 14 14 15 15 c->ndim = ndim; 16 c->items_per_row = 1;16 uint_t items_per_row = 1; 17 17 //c->shape = AUBIO_ARRAY(uint_t, ndim); 18 18 c->shape[0] = shape[0]; 19 19 for (i = 1; i < ndim; i++) { 20 20 c->shape[i] = shape[i]; 21 c->items_per_row *= shape[i];21 items_per_row *= shape[i]; 22 22 } 23 c-> n_items = c->items_per_row * shape[0];23 c->size = items_per_row * shape[0]; 24 24 c->data = AUBIO_ARRAY(smpl_t*, shape[0]); 25 c->data[0] = AUBIO_ARRAY(smpl_t, c-> n_items);25 c->data[0] = AUBIO_ARRAY(smpl_t, c->size); 26 26 for (i = 1; i < c->shape[0]; i++) { 27 c->data[i] = c->data[0] + i * c->items_per_row;27 c->data[i] = c->data[0] + i * items_per_row; 28 28 } 29 29 … … 89 89 uint_t i; 90 90 smpl_t max = -1000000; 91 for (i = 0; i < t-> n_items; i++) {91 for (i = 0; i < t->size; i++) { 92 92 max = MAX(t->data[0][i], max); 93 93 } -
src/ai/tensor.h
r6ad67a5 r83ec87f 27 27 28 28 typedef struct { 29 uint_t ndim; 30 uint_t shape[8]; 31 smpl_t **data; 32 uint_t n_items; 33 uint_t items_per_row; 29 uint_t ndim; //< number of dimensions 30 uint_t shape[8]; //< dimensions array 31 smpl_t **data; //< buffer of values 32 uint_t size; //< total number of elements 34 33 } aubio_tensor_t; 35 34
Note: See TracChangeset
for help on using the changeset viewer.