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

import numpy as np
import onnx

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

import numpy as np
import onnx

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")

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.

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.