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)
| 1435 | |
| 1436 | |
| 1437 | def repeat(t, repeats, axis=None): |
| 1438 | '''Return the repeated tensor |
| 1439 | |
| 1440 | Args: |
| 1441 | t(tensor): the tensor to be repeated |
| 1442 | repeats(int or a sequence): the number that the tensor need to repeat for |
| 1443 | axis (int):the axis to do repeat |
| 1444 | If it is None, then the repeated tensor will be flattened.If it isn't None, |
| 1445 | the repeats could be sequence, but it's size should match the axis's shape |
| 1446 | |
| 1447 | Returns: |
| 1448 | the tensor which has been repeated |
| 1449 | ''' |
| 1450 | ret = t.repeat(repeats, axis) |
| 1451 | return ret |
| 1452 | |
| 1453 | |
| 1454 | def tensordot(A, B, axes=2): |