From: Paul Brossier Date: Tue, 29 Jan 2019 02:14:39 +0000 (+0100) Subject: [tensor] have_same_shape returns false on null pointers X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=d6fdff6b02b64863213eef764f1b2debc63af6c0;p=aubio.git [tensor] have_same_shape returns false on null pointers --- diff --git a/src/ai/tensor.c b/src/ai/tensor.c index 8f196a39..976706a0 100644 --- a/src/ai/tensor.c +++ b/src/ai/tensor.c @@ -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;