[tensor] also set size when viewing fmat/fvec
authorPaul Brossier <piem@piem.org>
Wed, 2 Jan 2019 01:10:48 +0000 (02:10 +0100)
committerPaul Brossier <piem@piem.org>
Wed, 29 Dec 2021 16:51:45 +0000 (11:51 -0500)
src/ai/tensor.c

index 097ee22..60239a1 100644 (file)
@@ -61,6 +61,7 @@ uint_t aubio_fvec_as_tensor(fvec_t *o, aubio_tensor_t *c) {
   c->ndim = 1;
   c->shape[0] = o->length;
   c->data = &o->data;
+  c->size = o->length;
   return AUBIO_OK;
 }
 
@@ -80,6 +81,7 @@ uint_t aubio_fmat_as_tensor(fmat_t *o, aubio_tensor_t *c) {
   c->ndim = 2;
   c->shape[0] = o->height;
   c->shape[1] = o->length;
+  c->size = o->height * o->length;
   c->data = o->data;
   return AUBIO_OK;
 }