Return the repeated tensor Args: t(tensor): the tensor to be repeated repeats(int or a sequence): the number that the tensor need to repeat for axis (int):the axis to do repeat If it is None, then the repeated tensor will be flattened.If it isn't None
(t, repeats, axis=None)
| 1470 | |
| 1471 | |
| 1472 | def repeat(t, repeats, axis=None): |
| 1473 | '''Return the repeated tensor |
| 1474 | |
| 1475 | Args: |
| 1476 | t(tensor): the tensor to be repeated |
| 1477 | repeats(int or a sequence): the number that the tensor need to repeat for |
| 1478 | axis (int):the axis to do repeat |
| 1479 | If it is None, then the repeated tensor will be flattened.If it isn't None, |
| 1480 | the repeats could be sequence, but it's size should match the axis's shape |
| 1481 | |
| 1482 | Returns: |
| 1483 | the tensor which has been repeated |
| 1484 | ''' |
| 1485 | ret = t.repeat(repeats, axis) |
| 1486 | return ret |
| 1487 | |
| 1488 | |
| 1489 | def tensordot(A, B, axes=2): |