numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
tile(A, reps)

If :None:None:`reps` has length d , the result will have dimension of max(d, A.ndim) .

If A.ndim < d , A is promoted to be d-dimensional by prepending new axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication, or shape (1, 1, 3) for 3-D replication. If this is not the desired behavior, promote A to d-dimensions manually before calling this function.

If A.ndim > d , :None:None:`reps` is promoted to A.ndim by pre-pending 1's to it. Thus for an A of shape (2, 3, 4, 5), a :None:None:`reps` of (2, 2) is treated as (1, 1, 2, 2).

Parameters

A : array_like

The input array.

reps : array_like

The number of repetitions of A along each axis.

Returns

c : ndarray

The tiled output array.

Construct an array by repeating A the number of times given by reps.

See Also

broadcast_to

Broadcast an array to a new shape

repeat

Repeat elements of an array.

Examples

>>> a = np.array([0, 1, 2])
... np.tile(a, 2) array([0, 1, 2, 0, 1, 2])
>>> np.tile(a, (2, 2))
array([[0, 1, 2, 0, 1, 2],
       [0, 1, 2, 0, 1, 2]])
>>> np.tile(a, (2, 1, 2))
array([[[0, 1, 2, 0, 1, 2]],
       [[0, 1, 2, 0, 1, 2]]])
>>> b = np.array([[1, 2], [3, 4]])
... np.tile(b, 2) array([[1, 2, 1, 2], [3, 4, 3, 4]])
>>> np.tile(b, (2, 1))
array([[1, 2],
       [3, 4],
       [1, 2],
       [3, 4]])
>>> c = np.array([1,2,3,4])
... np.tile(c,(4,1)) array([[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.repeat skimage.restoration.inpaint.inpaint_biharmonic dask.array.creation.tile

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/shape_base.py#1171
type: <class 'function'>
Commit: