Changeset cc74a29 for src


Ignore:
Timestamp:
Jan 29, 2019, 1:14:21 AM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/crepe_org
Children:
3ff9654
Parents:
3ac1426
Message:

[tensor] add copy

Location:
src/ai
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ai/tensor.c

    r3ac1426 rcc74a29  
    235235#endif
    236236}
     237
     238void aubio_tensor_copy(aubio_tensor_t *s, aubio_tensor_t *t)
     239{
     240  if (!aubio_tensor_have_same_shape(s, t)) {
     241    AUBIO_ERR("tensor: not copying source tensor %s",
     242        aubio_tensor_get_shape_string(s));
     243    AUBIO_ERR(" to destination tensor %s",
     244        aubio_tensor_get_shape_string(t));
     245    return;
     246  }
     247  AUBIO_MEMCPY(t->buffer, s->buffer, s->size);
     248}
  • src/ai/tensor.h

    r3ac1426 rcc74a29  
    160160const char_t *aubio_tensor_get_shape_string(aubio_tensor_t *t);
    161161
     162/** compute matrix multiplication A x B = C
     163
     164  \param a  left tensor
     165  \param b  right tensor
     166  \param c  output tensor
     167
     168*/
    162169void aubio_tensor_matmul(aubio_tensor_t *a, aubio_tensor_t *b,
    163170    aubio_tensor_t *c);
     171
     172/** copy tensor
     173
     174  \param s  source tensor
     175  \param d  destination tensor
     176
     177*/
     178void aubio_tensor_copy(aubio_tensor_t *s, aubio_tensor_t *d);
    164179
    165180#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.