Changeset 17189b2 for src/ai/tensor.c


Ignore:
Timestamp:
Dec 29, 2021, 5:52:00 PM (2 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/crepe
Children:
3c754d5
Parents:
461a89f
git-author:
Paul Brossier <piem@piem.org> (01/28/19 22:56:27)
git-committer:
Paul Brossier <piem@piem.org> (12/29/21 17:52:00)
Message:

[tensor] rewrite and rename have_same_shape

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ai/tensor.c

    r461a89f r17189b2  
    138138}
    139139
    140 uint_t aubio_tensor_have_same_size(aubio_tensor_t *t, aubio_tensor_t *s)
     140uint_t aubio_tensor_have_same_shape(aubio_tensor_t *a, aubio_tensor_t *b)
    141141{
    142142  uint_t n;
    143   if (!t || !s) return 0;
    144   if (t->ndim != s->ndim) return 0;
    145   if (t->size != s->size) return 0;
    146   n = t->ndim;
    147   while (n--) {
    148     if (t->shape[n] != s->shape[n]) {
     143  AUBIO_ASSERT(a && b);
     144  if (a->ndim != b->ndim) {
     145    return 0;
     146  }
     147  for (n = 0; n < a->ndim; n++) {
     148    if (a->shape[n] != b->shape[n]) {
    149149      return 0;
    150150    }
Note: See TracChangeset for help on using the changeset viewer.