Changeset e18c30e


Ignore:
Timestamp:
Jan 29, 2019, 3:36:35 AM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/crepe_org
Children:
bf3ce2c
Parents:
7048b56
Message:

[conv2d] copy params in set_kernel, set_bias

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ai/conv2d.c

    r7048b56 re18c30e  
    479479uint_t aubio_conv2d_set_kernel(aubio_conv2d_t *c, aubio_tensor_t *kernel)
    480480{
    481   uint_t i;
    482481  AUBIO_ASSERT(c && kernel);
    483   for (i = 0; i < c->kernel->ndim; i++) {
    484     AUBIO_ASSERT(c->kernel->shape[i] == kernel->shape[i]);
    485   }
    486   return AUBIO_OK;
     482  if (aubio_tensor_have_same_shape(kernel, c->kernel)) {
     483    aubio_tensor_copy(kernel, c->kernel);
     484    return AUBIO_OK;
     485  }
     486  return AUBIO_FAIL;
    487487}
    488488
     
    496496{
    497497  AUBIO_ASSERT(c && bias);
    498   AUBIO_ASSERT(c->kernel_shape[1] == bias->length);
     498  if (bias->length == c->bias->length) {
     499    fvec_copy(bias, c->bias);
     500    return AUBIO_OK;
     501  }
    499502  return AUBIO_OK;
    500503}
Note: See TracChangeset for help on using the changeset viewer.