mindspore/docs/api/api_python/numpy/mindspore.numpy.tile.rst

17 lines
1.0 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.numpy.tile
=================================
.. py:function:: mindspore.numpy.tile(a, reps)
通过重复 ``a`` 指定次数构造一个数组,次数由 ``reps`` 给出。
如果 ``reps`` 的长度为 ``d`` ,结果将具有 ``max(d, a.ndim)`` 的维度。如果 ``a.ndim < d`` ,则通过在前面添加新轴将 ``a`` 提升为 ``d`` 维。因此shape为 ``(3,)`` 的数组会被提升为 ``(1, 3)`` 以进行二维复制,或 ``(1, 1, 3)`` 以进行三维复制。如果这不是所需的行为,可以在调用此函数之前手动将 ``a`` 提升为 ``d`` 维。如果 ``a.ndim > d`` 则通过在前面添加1来提升 ``reps````a.ndim`` 。因此对于shape为 ``(2, 3, 4, 5)````a`` ``reps````(2, 2)`` 被视为 ``(1, 1, 2, 2)``
参数:
- **a** (Tensor) - 输入数组。
- **reps** (int, ints的序列) - 在每个轴上重复 ``a`` 的次数。
返回:
Tensor重复后的输出数组。
异常:
- **TypeError** - 如果输入不是Tensor。