Changeset c4b6b59
 Timestamp:
 Jan 2, 2019, 10:58:45 PM (6 years ago)
 Branches:
 feature/cnn_org, feature/crepe_org
 Children:
 1343aca
 Parents:
 dc257cc
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/ai/tensor.c
rdc257cc rc4b6b59 2 2 #include "fmat.h" 3 3 #include "tensor.h" 4 5 #define STRN_LENGTH 40 6 #if !HAVE_AUBIO_DOUBLE 7 #define AUBIO_SMPL_TFMT "% 9.4f" 8 #else 9 #define AUBIO_SMPL_TFMT "% 9.4lf" 10 #endif /* HAVE_AUBIO_DOUBLE */ 4 11 5 12 aubio_tensor_t *new_aubio_tensor(uint_t ndim, uint_t *shape) … … 151 158 return shape_str; 152 159 } 160 161 static void aubio_tensor_print_subtensor(aubio_tensor_t *t, uint_t depth) 162 { 163 uint_t i; 164 AUBIO_MSG("["); 165 for (i = 0; i < t>shape[0]; i ++) { 166 AUBIO_MSG("%*s", i == 0 ? 0 : depth + 1, i == 0 ? "" : " "); 167 if (t>ndim == 1) { 168 AUBIO_MSG(AUBIO_SMPL_TFMT, t>buffer[i]); 169 } else { 170 aubio_tensor_t st; 171 aubio_tensor_get_subtensor(t, i, &st); 172 aubio_tensor_print_subtensor(&st, depth + 1); // recursive call 173 } 174 AUBIO_MSG("%s%s", (i < t>shape[0]  1) ? "," : "", 175 t>ndim == 1 ? " " : ((i < t>shape[0]  1) ? "\n" : "")); 176 } 177 AUBIO_MSG("]"); 178 } 179 180 void aubio_tensor_print(aubio_tensor_t *t) 181 { 182 AUBIO_MSG("tensor of shape %s\n", aubio_tensor_get_shape_string(t)); 183 aubio_tensor_print_subtensor(t, 0); 184 AUBIO_MSG("\n"); 185 }
Note: See TracChangeset
for help on using the changeset viewer.