Tile#

Tile - 13#

Version

  • name: Tile (GitHub)

  • domain: main

  • since_version: 13

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 13.

Summary

Constructs a tensor by tiling a given tensor. This is the same as function tile in Numpy, but no broadcast. For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]]

Inputs

  • input (heterogeneous) - T: Input tensor of any shape.

  • repeats (heterogeneous) - T1: 1D int64 tensor of the same length as input’s dimension number, includes numbers of repeated copies along input’s dimensions.

Outputs

  • output (heterogeneous) - T: Output tensor of the same dimensions and type as tensor input. output_dim[i] = input_dim[i] * repeats[i]

Type Constraints

  • T in ( tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain input and output types to all tensor types.

  • T1 in ( tensor(int64) ): Constrain repeat’s type to int64 tensors.

Examples

_tile

node = onnx.helper.make_node(
    'Tile',
    inputs=['x', 'y'],
    outputs=['z']
)

x = np.random.rand(2, 3, 4, 5).astype(np.float32)

repeats = np.random.randint(low=1, high=10, size=(np.ndim(x),)).astype(np.int64)

z = np.tile(x, repeats)

expect(node,
       inputs=[x, repeats],
       outputs=[z],
       name='test_tile')

_tile_precomputed

node = onnx.helper.make_node(
    'Tile',
    inputs=['x', 'y'],
    outputs=['z']
)

x = np.array([
    [0, 1],
    [2, 3]
], dtype=np.float32)

repeats = np.array([2, 2], dtype=np.int64)

z = np.array([
    [0, 1, 0, 1],
    [2, 3, 2, 3],
    [0, 1, 0, 1],
    [2, 3, 2, 3]
], dtype=np.float32)

expect(node,
       inputs=[x, repeats],
       outputs=[z],
       name='test_tile_precomputed')

Differences

00Constructs a tensor by tiling a given tensor.Constructs a tensor by tiling a given tensor.
11This is the same as function tile in Numpy, but no broadcast.This is the same as function tile in Numpy, but no broadcast.
22For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]]For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]]
33
44**Inputs****Inputs**
55
66* **input** (heterogeneous) - **T**:* **input** (heterogeneous) - **T**:
77 Input tensor of any shape. Input tensor of any shape.
88* **repeats** (heterogeneous) - **T1**:* **repeats** (heterogeneous) - **T1**:
99 1D int64 tensor of the same length as input's dimension number, 1D int64 tensor of the same length as input's dimension number,
1010 includes numbers of repeated copies along input's dimensions. includes numbers of repeated copies along input's dimensions.
1111
1212**Outputs****Outputs**
1313
1414* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
1515 Output tensor of the same dimensions and type as tensor input. Output tensor of the same dimensions and type as tensor input.
1616 output_dim[i] = input_dim[i] * repeats[i] output_dim[i] = input_dim[i] * repeats[i]
1717
1818**Type Constraints****Type Constraints**
1919
2020* **T** in (* **T** in (
21 tensor(bfloat16),
2122 tensor(bool), tensor(bool),
2223 tensor(complex128), tensor(complex128),
2324 tensor(complex64), tensor(complex64),
2425 tensor(double), tensor(double),
2526 tensor(float), tensor(float),
2627 tensor(float16), tensor(float16),
2728 tensor(int16), tensor(int16),
2829 tensor(int32), tensor(int32),
2930 tensor(int64), tensor(int64),
3031 tensor(int8), tensor(int8),
3132 tensor(string), tensor(string),
3233 tensor(uint16), tensor(uint16),
3334 tensor(uint32), tensor(uint32),
3435 tensor(uint64), tensor(uint64),
3536 tensor(uint8) tensor(uint8)
3637 ): ):
3738 Constrain input and output types to all tensor types. Constrain input and output types to all tensor types.
3839* **T1** in (* **T1** in (
3940 tensor(int64) tensor(int64)
4041 ): ):
4142 Constrain repeat's type to int64 tensors. Constrain repeat's type to int64 tensors.

Tile - 6#

Version

  • name: Tile (GitHub)

  • domain: main

  • since_version: 6

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 6.

Summary

Constructs a tensor by tiling a given tensor. This is the same as function tile in Numpy, but no broadcast. For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]]

Inputs

  • input (heterogeneous) - T: Input tensor of any shape.

  • repeats (heterogeneous) - T1: 1D int64 tensor of the same length as input’s dimension number, includes numbers of repeated copies along input’s dimensions.

Outputs

  • output (heterogeneous) - T: Output tensor of the same dimensions and type as tensor input. output_dim[i] = input_dim[i] * repeats[i]

Type Constraints

  • T in ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain input and output types to all tensor types.

  • T1 in ( tensor(int64) ): Constrain repeat’s type to int64 tensors.

Differences

0Repeat the elements of a tensor along an axis.
1
20**Inputs**Constructs a tensor by tiling a given tensor.
3
1This is the same as function tile in Numpy, but no broadcast.
42* **input** (heterogeneous) - **T**:For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]]
3
54 Input tensor of any shape.**Inputs**
5
66* **tiles** (heterogeneous) - **T**:* **input** (heterogeneous) - **T**:
77 Number of repeated copies to make of the input tensor. Input tensor of any shape.
88* **axis** (heterogeneous) - **T**:* **repeats** (heterogeneous) - **T1**:
99 Axis along which to repeat. 1D int64 tensor of the same length as input's dimension number,
10 includes numbers of repeated copies along input's dimensions.
1011
1112**Outputs****Outputs**
1213
1314* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
1415 Output tensor of same shape and type as input. Output tensor of the same dimensions and type as tensor input.
16 output_dim[i] = input_dim[i] * repeats[i]
1517
1618**Type Constraints****Type Constraints**
1719
1820* **T** in (* **T** in (
21 tensor(bool),
22 tensor(complex128),
23 tensor(complex64),
1924 tensor(double), tensor(double),
2025 tensor(float), tensor(float),
2126 tensor(float16) tensor(float16),
27 tensor(int16),
28 tensor(int32),
29 tensor(int64),
30 tensor(int8),
31 tensor(string),
32 tensor(uint16),
33 tensor(uint32),
34 tensor(uint64),
35 tensor(uint8)
2236 ): ):
2337 Constrain input types to float tensors. Constrain input and output types to all tensor types.
2438* **T1** in (* **T1** in (
2539 tensor(int64) tensor(int64)
2640 ): ):
2741 Constrain tiles and axis's type to int64 tensors. Constrain repeat's type to int64 tensors.

Tile - 1#

Version

  • name: Tile (GitHub)

  • domain: main

  • since_version: 1

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

This version of the operator has been available since version 1.

Summary

Repeat the elements of a tensor along an axis.

Inputs

  • input (heterogeneous) - T: Input tensor of any shape.

  • tiles (heterogeneous) - T: Number of repeated copies to make of the input tensor.

  • axis (heterogeneous) - T: Axis along which to repeat.

Outputs

  • output (heterogeneous) - T: Output tensor of same shape and type as input.

Type Constraints

  • T in ( tensor(double), tensor(float), tensor(float16) ): Constrain input types to float tensors.

  • T1 in ( tensor(int64) ): Constrain tiles and axis’s type to int64 tensors.