Join the newly launched Discord
community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.backend.tile
Stay organized with collections
Save and categorize content based on your preferences.
Constructs a tensor by tiling a given tensor.
meridian
.
backend
.
tile
(
input
:
Annotated
[
Any
,
TV_Tile_T
],
multiples
:
Annotated
[
Any
,
TV_Tile_Tmultiples
],
name
=
None
)
->
Annotated
[
Any
,
TV_Tile_T
]
This operation creates a new tensor by replicating input
multiples
times.
The output tensor's i'th dimension has input.dims(i) * multiples[i]
elements,
and the values of input
are replicated multiples[i]
times along the 'i'th
dimension. For example, tiling [a b c d]
by [2]
produces [a b c d a b c d]
.
>>>
a
=
tf
.
constant
([[
1
,
2
,
3
],[
4
,
5
,
6
]],
tf
.
int32
)
>>>
b
=
tf
.
constant
([
1
,
2
],
tf
.
int32
)
>>>
tf
.
tile
(
a
,
b
)
< tf
.
Tensor
:
shape
=
(
2
,
6
),
dtype
=
int32
,
numpy
=
array
([[
1
,
2
,
3
,
1
,
2
,
3
],
[
4
,
5
,
6
,
4
,
5
,
6
]],
dtype
=
int32
)
>
>>>
c
=
tf
.
constant
([
2
,
1
],
tf
.
int32
)
>>>
tf
.
tile
(
a
,
c
)
< tf
.
Tensor
:
shape
=
(
4
,
3
),
dtype
=
int32
,
numpy
=
array
([[
1
,
2
,
3
],
[
4
,
5
,
6
],
[
1
,
2
,
3
],
[
4
,
5
,
6
]],
dtype
=
int32
)
>
>>>
d
=
tf
.
constant
([
2
,
2
],
tf
.
int32
)
>>>
tf
.
tile
(
a
,
d
)
< tf
.
Tensor
:
shape
=
(
4
,
6
),
dtype
=
int32
,
numpy
=
array
([[
1
,
2
,
3
,
1
,
2
,
3
],
[
4
,
5
,
6
,
4
,
5
,
6
],
[
1
,
2
,
3
,
1
,
2
,
3
],
[
4
,
5
,
6
,
4
,
5
,
6
]],
dtype
=
int32
)
>
A Tensor
. Can be of any rank.
A Tensor
. Must be one of the following types: int32
, int64
.
1-D. Length must be the same as the number of dimensions in input
A name for the operation (optional).
A Tensor
. Has the same type as input
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-19 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-19 UTC."],[],[],null,["# meridian.backend.tile\n\n\u003cbr /\u003e\n\nConstructs a tensor by tiling a given tensor. \n\n meridian.backend.tile(\n input: Annotated[Any, TV_Tile_T],\n multiples: Annotated[Any, TV_Tile_Tmultiples],\n name=None\n ) -\u003e Annotated[Any, TV_Tile_T]\n\nThis operation creates a new tensor by replicating `input` `multiples` times.\nThe output tensor's i'th dimension has `input.dims(i) * multiples[i]` elements,\nand the values of `input` are replicated `multiples[i]` times along the 'i'th\ndimension. For example, tiling `[a b c d]` by `[2]` produces\n`[a b c d a b c d]`. \n\n \u003e\u003e\u003e a = tf.constant([[1,2,3],[4,5,6]], tf.int32)\n \u003e\u003e\u003e b = tf.constant([1,2], tf.int32)\n \u003e\u003e\u003e tf.tile(a, b)\n \u003ctf.Tensor: shape=(2, 6), dtype=int32, numpy=\n array([[1, 2, 3, 1, 2, 3],\n [4, 5, 6, 4, 5, 6]], dtype=int32)\u003e\n \u003e\u003e\u003e c = tf.constant([2,1], tf.int32)\n \u003e\u003e\u003e tf.tile(a, c)\n \u003ctf.Tensor: shape=(4, 3), dtype=int32, numpy=\n array([[1, 2, 3],\n [4, 5, 6],\n [1, 2, 3],\n [4, 5, 6]], dtype=int32)\u003e\n \u003e\u003e\u003e d = tf.constant([2,2], tf.int32)\n \u003e\u003e\u003e tf.tile(a, d)\n \u003ctf.Tensor: shape=(4, 6), dtype=int32, numpy=\n array([[1, 2, 3, 1, 2, 3],\n [4, 5, 6, 4, 5, 6],\n [1, 2, 3, 1, 2, 3],\n [4, 5, 6, 4, 5, 6]], dtype=int32)\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| `input` | A `Tensor`. Can be of any rank. |\n| `multiples` | A `Tensor`. Must be one of the following types: `int32`, `int64`. 1-D. Length must be the same as the number of dimensions in `input` |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor`. Has the same type as `input`. ||\n\n\u003cbr /\u003e"]]