Changeset 0dad503


Ignore:
Timestamp:
Dec 29, 2021, 5:52:01 PM (3 weeks ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/crepe
Children:
1b9fe24
Parents:
7897b51
git-author:
Paul Brossier <piem@piem.org> (01/29/19 01:14:21)
git-committer:
Paul Brossier <piem@piem.org> (12/29/21 17:52:01)
Message:

[tensor] add copy

Location:
src/ai
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ai/tensor.c

    r7897b51 r0dad503  
    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

    r7897b51 r0dad503  
    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.