[tensor] have_same_shape returns false on null pointers
authorPaul Brossier <piem@piem.org>
Tue, 29 Jan 2019 02:14:39 +0000 (03:14 +0100)
committerPaul Brossier <piem@piem.org>
Tue, 29 Jan 2019 02:14:39 +0000 (03:14 +0100)
src/ai/tensor.c

index 8f196a3..976706a 100644 (file)
@@ -140,10 +140,11 @@ uint_t aubio_tensor_get_subtensor(aubio_tensor_t *t, uint_t i,
 uint_t aubio_tensor_have_same_shape(aubio_tensor_t *a, aubio_tensor_t *b)
 {
   uint_t n;
-  AUBIO_ASSERT(a && b);
-  if (a->ndim != b->ndim) {
+  if (!a || !b)
     return 0;
-  }
+  if (a->ndim != b->ndim)
+    return 0;
+
   for (n = 0; n < a->ndim; n++) {
     if (a->shape[n] != b->shape[n]) {
       return 0;