Tile#

  • Domain: ai.onnx

  • Since version: 13

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 (T): Input tensor of any shape.

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

Outputs

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

Type Constraints

  • T: Constrain input and output types to all tensor types. Allowed types: 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).

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

Examples#

test_cc_shape_inference_resize_tile

Node:
  Tile(resized_out, repeats) -> (tile_out)
Inputs:
  resized_out: shape=(10, 6), dtype=float32
    [[ 1.,  2.,  3.,  4.,  5.,  6.],
     [ 7.,  8.,  9., 10., 11., 12.],
     [13., 14., 15., 16., 17., 18.],
     [19., 20., 21., 22., 23., 24.],
     [25., 26., 27., 28., 29., 30.],
     [31., 32., 33., 34., 35., 36.],
     [37., 38., 39., 40., 41., 42.],
     [43., 44., 45., 46., 47., 48.],
     [49., 50., 51., 52., 53., 54.],
     [55., 56., 57., 58., 59., 60.]]

Outputs:
  tile_out: shape=(10, 6), dtype=float32
    [[ 1.,  3.,  5.,  1.,  3.,  5.],
     [13., 15., 17., 13., 15., 17.],
     [25., 27., 29., 25., 27., 29.],
     [37., 39., 41., 37., 39., 41.],
     [49., 51., 53., 49., 51., 53.],
     [ 1.,  3.,  5.,  1.,  3.,  5.],
     [13., 15., 17., 13., 15., 17.],
     [25., 27., 29., 25., 27., 29.],
     [37., 39., 41., 37., 39., 41.],
     [49., 51., 53., 49., 51., 53.]]

test_cc_tile_1d

Node:
  Tile(x, y) -> (z)
Inputs:
  x: shape=(3,), dtype=float32
    [1., 2., 3.]
  y: shape=(1,), dtype=int64
    [3]

Outputs:
  z: shape=(9,), dtype=float32
    [1., 2., 3., 1., 2., 3., 1., 2., 3.]

test_cc_tile_precomputed

Node:
  Tile(x, y) -> (z)
Inputs:
  x: shape=(2, 2), dtype=float32
    [[0., 1.],
     [2., 3.]]
  y: shape=(2,), dtype=int64
    [2, 2]

Outputs:
  z: shape=(4, 4), dtype=float32
    [[0., 1., 0., 1.],
     [2., 3., 2., 3.],
     [0., 1., 0., 1.],
     [2., 3., 2., 3.]]

test_cc_tile_repeats_one

Node:
  Tile(x, y) -> (z)
Inputs:
  x: shape=(2, 2), dtype=float32
    [[1., 2.],
     [3., 4.]]
  y: shape=(2,), dtype=int64
    [1, 1]

Outputs:
  z: shape=(2, 2), dtype=float32
    [[1., 2.],
     [3., 4.]]

Differences with previous version (6)#

SchemaDiff: Tile (domain 'ai.onnx')

  • old version: 6

  • new version: 13

  • breaking: no

Type constraints:

  • changed ‘T’: added types: [‘tensor(bfloat16)’]

Version History#