Changeset 21631e9
- Timestamp:
- Jan 28, 2019, 10:48:58 PM (6 years ago)
- Branches:
- feature/crepe_org
- Children:
- 1df9cd1
- Parents:
- 75662eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ai/tensor.c
r75662eb r21631e9 170 170 char_t shape_str_previous[STRN_LENGTH] = "("; 171 171 for (i = 0; i < t->ndim; i++) { 172 int len = snprintf(shape_str, STRN_LENGTH, "%s%d%s", 173 shape_str_previous, t->shape[i], (i == t->ndim - 1) ? "" : ", "); 172 // and space last if not the last one 173 int add_space = (i < t->ndim - 1); 174 // add coma first if this not last, or always if 1d 175 int add_coma = add_space || (t->ndim == 1); 176 int len = snprintf(shape_str, STRN_LENGTH, "%s%d%s%s", 177 shape_str_previous, t->shape[i], 178 add_coma ? "," : "", add_space ? " " : ""); 174 179 strncpy(shape_str_previous, shape_str, len); 175 180 }
Note: See TracChangeset
for help on using the changeset viewer.