NumPy tile repeats an array pattern according to a repetition count for each axis
Repeating a whole pattern is different from repeating each individual entry. NumPy tile constructs an array from repeated copies of an input pattern, with repetition counts assigned to axes. Academia Master Trader presents this English lesson for readers in Lebanon, using constructed arrays to explain the output order, shape calculation and dimensional promotion rules.
Repeat a vector as a complete sequence
After import numpy as np, define v = np.array([2,5,8]). The call np.tile(v,2) returns [2,5,8,2,5,8], with shape (6,).
The sequence two, five, eight appears twice. The operation does not produce [2,2,5,5,8,8], which would repeat each entry beside itself. Identify the unit being repeated before choosing a function: tile repeats the input pattern along an axis rather than grouping duplicate copies of each individual value.

A tuple supplies counts for several axes
The call np.tile(v,(2,2)) returns [[2,5,8,2,5,8],[2,5,8,2,5,8]], with shape (2,6). The second repetition count doubles the sequence horizontally, while the first produces two rows.
Because the input is one dimensional and the repetition tuple has two entries, NumPy first treats the vector as having shape (1,3). It prepends a length one axis. Multiplying those axis lengths by the corresponding repetition counts gives two by six, matching the output shape.
A short count is aligned with the trailing axes
Define m = np.array([[1,4],[7,10]]), with shape (2,2). The call np.tile(m,2) returns [[1,4,1,4],[7,10,7,10]], with shape (2,4).
A single repetition count does not double every axis. Since the input has two dimensions, the count is treated as (1,2): one copy along the first axis and two along the second. To repeat the matrix vertically instead, use np.tile(m,(2,1)), which gives shape (4,2) and rows [1,4], [7,10], [1,4], [7,10].
Longer tuples can introduce leading axes
The call np.tile(v,(2,1,2)) has shape (2,1,6). The vector is treated as shape (1,1,3) before the repetition counts are applied. The result has two leading blocks, each containing one row of the sequence repeated twice.
This is dimensional promotion, not transposition. Existing axes keep their relative order. When a different arrangement is intended, reshape the input deliberately before tiling rather than expecting the repetition tuple to exchange axes. Write the promoted input shape beside the counts to make the output dimensions easier to follow.
For a simple size check, the vector has three entries and two copies contain six entries. For the matrix, the (2,1) counts produce two complete copies of a four entry input, giving eight positions. This count complements the shape calculation without replacing the need to track each axis separately.
Keep the purpose of replication clear
Tile constructs a repeated output array. When the goal is only to combine compatible shapes during arithmetic, NumPy's documentation recommends broadcasting operations instead of using tile to imitate broadcasting. These are related ideas, but they are not interchangeable descriptions of the same task.
Continue learning with Academia Master Trader at academiamastertrader.com.br and in Aprenda. Record the repeated pattern, aligned repetition counts and resulting shape before passing a tiled array to another calculation.